code html
- Code: Tout sélectionner
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<div>
<form action ="server.php" method ="post">
section, montant, couleur, presentation, parain pays
Nom : <input type ="text" name ="nom" id ="nom" /> <br/>
Prenom : <input type ="text" name ="prenom" id ="prenom" /> <br/>
Numero : <input type ="number" name ="numero" id ="numero" /> <br/>
Section : <input type ="text" name ="section" id ="section" /> <br/>
Montant : <input type ="number" name ="montant" id ="montant" /> <br/>
Couleur : <input type ="text" name ="couleur" id ="couleur" /> <br/>
Presentation : <input type ="text" name ="presentation" id ="presentation" /> <br/>
Parain : <input type ="text" name ="parain" id ="parain" /> <br/>
Pays : <input type ="text" name ="pays" id ="pays" /> <br/>
</form>
</div>
</body>
</html>
code php de server.php
- Code: Tout sélectionner
<?php
try {
$bdd = new PDO('mysql:host=localhost;dbname=essai', 'root', '');
}
catch(Exception $e) {
die('Erreur : '.$e->getMessage());
}
$a = $bdd ->prepare( 'INSERT INTO infos (nom, prenom, numero, section, montant, couleur, presentation, parain, pays ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)');
$a ->execute(array($_POST['nom'], $_POST['prenom'], $_POST['numero'], $_POST['section'], $_POST['montant'], $_POST['couleur'], $_POST['presentation'], $_POST['parain'], $_POST['pays']));
?>