Advertisement
DesenvolverBatch

crud.php

Oct 28th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php  
  2. /* Aqui você faz a requisição do arquivo conexão.php */
  3. require_once "conexao.class.php";
  4. require_once "crud.class.php";
  5.  
  6. $con = new conexao();
  7. $operacao = new crud("contatos");
  8.  
  9. /* Aqui é a passagem dos valores das variaveis */
  10. $acao = $_GET['acao'];
  11. $nome = $_POST['nome'];
  12. $fone = $_POST['fone'];
  13.  
  14.  
  15. if(isset($_GET["id"])){
  16.     $id = $_GET["id"];
  17. }
  18.  
  19. switch($acao){
  20.  
  21.     case "adicionar":{
  22.         $operacao->inserir($nome,$fone);
  23.         break;
  24.     }
  25.  
  26.     case "remover":{
  27.         $operacao->deletar($id);
  28.         break;
  29.     }
  30.  
  31.     case "atualizar":{
  32.         $operacao->editar($nome,$fone,$id);
  33.         break;
  34.     }
  35.    
  36.  
  37.     default;{
  38.  header ("Location:index.php");
  39. }
  40.  
  41. }
  42.  
  43. header ("Location:index.php");
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement