Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <head>
- <title>test</title>
- <style type="text/css">
- </style>
- <link src="jquery-3.1.1.slim.min.js"></script>
- <link src="myjs1.js"></script>
- <script type="text/javascript">
- $("submit").click(function(){
- $. Ajax ({
- type: 'post',
- url: db.php ,
- data: les données ,
- success: alert('L'action est envoyée') ,
- dataType: dataType
- });
- function(data, status){
- alert("Data");
- };
- });
- </script>
- </head>
- <body>
- <div style="position: relative;" id="form-content">
- <form method="post" id="form">
- id :<input type="text" name="id" placeholder="id"><br><br>
- nom :<input type="text" name="nom" placeholder="nom"><br><br>
- prenom :<input type="text" name="prenom" placeholder="prenom"><br><br>
- age :<input type="text" name="age" placeholder="age"><br><br>
- <input type="submit" name="add" value="Ajouter" id="click">
- </form>
- </div>
- <span id="span1" style="position: relative;">
- <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>
- </span>
- <body>
- </html>
- <?php
- $servername = "localhost";
- $username = "username";
- $password = "";
- $dbname = "test";
- // Create connection
- $con = mysqli_connect("$servername", "$username", "$password", "$dbname");
- // Check connection
- if ($con->connect_error) {
- die("Connection failed: " . $con->connect_error);
- }
- // Local variables
- $id = (isset($_POST['id']) ? $_POST['id'] : '');
- $nom = (isset($_POST['nom']) ? $_POST['nom'] : '');
- $prenom = (isset($_POST['prenom']) ? $_POST['prenom'] : '');
- $age = (isset($_POST['age']) ? $_POST['age'] : '');
- // Sql reqest
- $sql= "INSERT INTO prsn (id,nom,prenom,age) VALUES ($id,'$nom','$prenom',$age)";
- $query=mysqli_query($con,$sql);
- header("Location:index.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement