Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. if(isset($_POST['save']))
  2. {
  3. echo "<pre>";
  4. print_r($_POST);
  5. echo "</pre>";
  6. $query = 'INSERT INTO restaurants (nom, lieu, tickets) VALUES (:nom, :lieu, :tickets)';
  7. $prep = $pdo->prepare($query);
  8. $prep->bindValue(':nom', $_POST['nom'], PDO::PARAM_STR);
  9. $prep->bindValue(':lieu', $_POST['lieu'], PDO::PARAM_STR);
  10. $prep->bindValue(':tickets', $_POST['tickets'], PDO::PARAM_BOOL);
  11. $prep->execute();
  12.  
  13. }
  14.  
  15. ?>
  16.  
  17. <div class="forminsert">
  18.  
  19. <form action="PI.php" method="post">
  20. <label id="first"> Nom du restaurant:</label><br/>
  21. <input type="text" name="nom"><br/>
  22.  
  23. <label id="first">lieu</label><br/>
  24. <input type="text" name="lieu"><br/>
  25.  
  26. <label id="first">Accepte les tickets restaurants ?</label><br/>
  27. <input type="checkbox" name="tickets" value="1"><br/>
  28.  
  29. <input type="submit" name="save"/>
  30.  
  31. </form>
  32.  
  33. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement