1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <html>
<head>
</head>
<body>
<?php
$prenom = $_POST['prenom'] ;
$nom = $_POST['nom'] ;
$adresse = $_POST['adresse'] ;
echo"
<form method='post' action='form.php'>
Prenom :
<br/>
<input type='text' name='prenom'/>
Nom :
<br/>
<input type='text' name='nom'/>
Adresse :
<br/>
<input type='text' name='adresse'/>
<input type='submit' value='Inscription'/>
</form>
";
$bdd = new PDO('mysql:host=localhost;dbname=amateurs','root','');
$req = $bdd->prepare("INSERT INTO agent(prenom,nom,adresse) VALUE (:prenom, :nom, :adresse)");
$req->bindValue(:prenom, '$prenom', PDO: ARAM_STR);
$req->bindValue(:nom, '$nom', PDO: ARAM_STR);
$req->bindValue(:adresse, '$adresse', PDO: ARAM_STR);
$req->execute();
?>
</body>
</html> |