Advertisement
HazielKaos

entree_donnee

Apr 7th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <title>donnees</title>
  6.     </head>
  7.    
  8.   <body>
  9.   <h2>inventaire</h2>
  10.  
  11. <?php
  12.  
  13. $servername = "localhost";
  14. $username = "root";
  15. $password = "";
  16. $dbname = "inscription";
  17.  
  18. // Create connection
  19. $link = new mysqli($servername, $username, $password, $dbname);
  20.  
  21. $nom=$link->real_escape_string($_POST["Nom"]);
  22. $prenom=$link->real_escape_string($_POST["Prenom"]);
  23. $email=$link->real_escape_string($_POST["Email"]);
  24. $adresse_postale=$link->real_escape_string($_POST["Adresse_postale"]);
  25. $cours_de_francais=$link->real_escape_string($_POST["Cours_de_francais"]);
  26. $cours_de_maths=$link->real_escape_string($_POST["Cours_de_maths"]);
  27. $cours_scientifiques=$link->real_escape_string($_POST["Cours_scientifiques"]);
  28. $commentaires=$link->real_escape_string($_POST["Commentaires"]);
  29.  
  30.  
  31.  
  32. // Check connection
  33. if ($link->connect_error) {
  34.     die("Connection failed: " . $link->connect_error);
  35. }
  36.  
  37. $sql = "INSERT INTO utilisateur (ID, Nom, Prenom, Email, Adresse_postale, Cours_de_francais, Cours_de_maths, Cours_scientifiques, Commentaires)
  38. VALUES (null, '".$nom."', '".$prenom."', '".$email."', '".$adresse_postale."', '".$cours_de_francais."', '".$cours_de_maths."', '".$cours_scientifiques."', '".$commentaires."')";
  39.  
  40. if ($link->query($sql) === TRUE) {
  41.     echo "New record created successfully";
  42. } else {
  43.     echo "Error: " . $sql . "<br>" . $link->error;
  44. }
  45.  
  46. $link->close();
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement