Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function eg_cadastro_cidade () {
- $nome_cidade = $_POST["nome_cidade"];
- $estado = $_POST["estado"];
- //insert
- if(isset($_POST['insert'])){
- global $wpdb;
- $wpdb->insert( 'cidade', //table
- array('nome_cidade' => $nome_cidade,'nome_cidade' => $nome_cidade), //nome
- array('estado' => $estado,'estado' => $estado) //estado
- //array('%s','%s') //inserção de data no cadastro usa essa linha
- );
- $message.="Cidade cadastrada com sucesso";
- }
- ?>
- <link type="text/css" href="<?php echo WP_PLUGIN_URL; ?>/GerePRO/style-admin.css" rel="stylesheet" />
- <div class="wrap">
- <h2>Adicionar Nova Cidade</h2>
- <?php if (isset($message)): ?><div class="updated"><p><?php echo $message;?></p></div><?php endif;?>
- <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
- <p>Cadastro de Cidades</p>
- <table class='wp-list-table widefat fixed'>
- <tr><th>Nome</th><td><input type="text" name="nome_cidade" value="<?php echo $nome_cidade;?>"/></td></tr>
- <tr><th>Estado</th><td><input type="text" name="estado" value="<?php echo $estado;?>"/></td></tr>
- </table>
- <input type='submit' name="insert" value='Cadastrar' class='button'>
- </form>
- </div>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment