Charles_Mad

nova-cidade.php

Jun 8th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2. function eg_cadastro_cidade () {
  3. $nome_cidade = $_POST["nome_cidade"];
  4. $estado = $_POST["estado"];
  5. //insert
  6. if(isset($_POST['insert'])){
  7. global $wpdb;
  8. $wpdb->insert( 'cidade', //table
  9. array('nome_cidade' => $nome_cidade,'nome_cidade' => $nome_cidade), //nome
  10. array('estado' => $estado,'estado' => $estado) //estado
  11.  
  12. //array('%s','%s') //inserção de data no cadastro usa essa linha
  13. );
  14. $message.="Cidade cadastrada com sucesso";
  15. }
  16. ?>
  17. <link type="text/css" href="<?php echo WP_PLUGIN_URL; ?>/GerePRO/style-admin.css" rel="stylesheet" />
  18. <div class="wrap">
  19. <h2>Adicionar Nova Cidade</h2>
  20. <?php if (isset($message)): ?><div class="updated"><p><?php echo $message;?></p></div><?php endif;?>
  21. <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  22. <p>Cadastro de Cidades</p>
  23. <table class='wp-list-table widefat fixed'>
  24. <tr><th>Nome</th><td><input type="text" name="nome_cidade" value="<?php echo $nome_cidade;?>"/></td></tr>
  25. <tr><th>Estado</th><td><input type="text" name="estado" value="<?php echo $estado;?>"/></td></tr>
  26. </table>
  27. <input type='submit' name="insert" value='Cadastrar' class='button'>
  28. </form>
  29. </div>
  30. <?php
  31. }
Advertisement
Add Comment
Please, Sign In to add comment