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
| <?php
if(isset($_POST['valider'])){
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$adresse = $_POST['adresse'];
$age = $_POST['age'];
$email = $_POST['email'];
$tel = $_POST['tel'];
$civilite = $_POST['civilite'];
$preference = $_POST['checkbox']; // on récupère les choix
for ( $i=0; $i<sizeof ( $preference ); $i++ ) {
$preference = $preference[$i];
}
$assurance = $_POST['assurance'];
$matriculation = $_POST['matriculation'];
$pseudo = $_POST['pseudo'];
$mdp = $_POST['mdp'];
$verification = "select * from conducteurs where pseudo = '$pseudo'";
$resultat_verification = mysql_query($verification);
if(mysql_num_rows($resultat_verification)==1) echo "déjà existant, tapez un autre SVP";
else{
$insertion = "insert into conducteurs (nom,prenom,adresse,age,email,tel,civilite,preference,n_assurance,matriculation,pseudo,mdp) values ('$nom','$prenom','$adresse','$age','$email','$tel','$civilite','$preference[$i]','$assurance','$matriculation','$pseudo','$mdp')";
$resultat_insertion = mysql_query($insertion);
}
}
?> |
Partager