Advertisement
Guest User

Untitled

a guest
Mar 17th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <title>test</title>
  4. <style type="text/css">
  5. </style>
  6. <link src="jquery-3.1.1.slim.min.js"></script>
  7. <link src="myjs1.js"></script>
  8. <script type="text/javascript">
  9. $("submit").click(function(){
  10. $. Ajax ({
  11. type: 'post',
  12. url: db.php ,
  13. data: les données ,
  14. success: alert('L'action est envoyée') ,
  15. dataType: dataType
  16. });
  17. function(data, status){
  18. alert("Data");
  19. };
  20. });
  21. </script>
  22. </head>
  23. <body>
  24. <div style="position: relative;" id="form-content">
  25. <form method="post" id="form">
  26. id :<input type="text" name="id" placeholder="id"><br><br>
  27. nom :<input type="text" name="nom" placeholder="nom"><br><br>
  28. prenom :<input type="text" name="prenom" placeholder="prenom"><br><br>
  29. age :<input type="text" name="age" placeholder="age"><br><br>
  30. <input type="submit" name="add" value="Ajouter" id="click">
  31. </form>
  32. </div>
  33. <span id="span1" style="position: relative;">
  34. <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d83998.94722685362!2d2.2775168640288337!3d48.85883773913696!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47e66e1f06e2b70f%3A0x40b82c3688c9460!2sParis!5e0!3m2!1sen!2sfr!4v1489763283156" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
  35. </span>
  36. <body>
  37. </html>
  38.  
  39. <?php
  40. $servername = "localhost";
  41. $username = "username";
  42. $password = "";
  43. $dbname = "test";
  44.  
  45. // Create connection
  46. $con = mysqli_connect("$servername", "$username", "$password", "$dbname");
  47.  
  48. // Check connection
  49. if ($con->connect_error) {
  50. die("Connection failed: " . $con->connect_error);
  51. }
  52.  
  53. // Local variables
  54. $id = (isset($_POST['id']) ? $_POST['id'] : '');
  55. $nom = (isset($_POST['nom']) ? $_POST['nom'] : '');
  56. $prenom = (isset($_POST['prenom']) ? $_POST['prenom'] : '');
  57. $age = (isset($_POST['age']) ? $_POST['age'] : '');
  58.  
  59. // Sql reqest
  60. $sql= "INSERT INTO prsn (id,nom,prenom,age) VALUES ($id,'$nom','$prenom',$age)";
  61.  
  62. $query=mysqli_query($con,$sql);
  63.  
  64. header("Location:index.php");
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement