Charles_Mad

nova

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