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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<?php
// On commence par récupérer les champs
if(isset($_POST['nom'])) $nom=$_POST['nom'];
else $nom="";
if(isset($_POST['prenom'])) $prenom=$_POST['prenom'];
else $prenom="";
if(isset($_POST['date'])) $date=$_POST['date'];
else $date="";
if(isset($_POST['rue'])) $icq=$_POST['rue'];
else $rue="";
if(isset($_POST['numero'])) $titre=$_POST['numero'];
else $numero="";
if(isset($_POST['codepostal'])) $url=$_POST['codepostal'];
else $codepostal="";
if(isset($_POST['ville'])) $url=$_POST['ville'];
else $ville="";
if(isset($_POST['telephone'])) $url=$_POST['telephone'];
else $telephone="";
if(isset($_POST['mail'])) $url=$_POST['mail'];
else $mail="";
if(isset($_POST['telurgence'])) $url=$_POST['telurgence'];
else $telurgence="";
if(isset($_POST['remarque'])) $url=$_POST['remarque'];
else $remarque="";
if(isset($_POST['nomparticipant'])) $url=$_POST['nomparticipant'];
else $nomparticipant="";
if(isset($_POST['prenomparticipant'])) $url=$_POST['prenomparticipant'];
else $prenomparticipant="";
if(isset($_POST['dateparticipant'])) $url=$_POST['dateparticipant'];
else $dateparticipant="";
if(isset($_POST['rueparticipant'])) $url=$_POST['rueparticipant'];
else $rueparticipant="";
if(isset($_POST['numeroparticipant'])) $url=$_POST['numeroparticipant'];
else $numeroparticipant="";
if(isset($_POST['codepostalparticipant'])) $url=$_POST['codepostalparticipant'];
else $codepostalparticipant="";
if(isset($_POST['villeparticipant'])) $url=$_POST['villeparticipant'];
else $villeparticipant="";
if(isset($_POST['telephoneparticipant'])) $url=$_POST['telephoneparticipant'];
else $telephoneparticipant="";
if(isset($_POST['mailparticipant'])) $url=$_POST['mailparticipant'];
else $mailparticipant="";
if(isset($_POST['choixlangue'])) $url=$_POST['choixlangue'];
else $choixlangue="";
if(isset($_POST['choixetudiant'])) $url=$_POST['choixetudiant'];
else $choixetudiant="";
if(isset($_POST['branche'])) $url=$_POST['branche'];
else $branche="";
if(isset($_POST['comboannee'])) $url=$_POST['comboannee'];
else $comboannee="";
if(isset($_POST['nomecole'])) $url=$_POST['nomecole'];
else $nomecole="";
if(isset($_POST['villeecole'])) $url=$_POST['villeecole'];
else $villeecole="";
if(isset($_POST['nomprofesseur'])) $url=$_POST['nomprofesseur'];
else $nomprofesseur="";
if(isset($_POST['nommanuelsuivi'])) $url=$_POST['nommanuelsuivi'];
else $nommanuelsuivi="";
if(isset($_POST['pasdemanuel'])) $url=$_POST['pasdemanuel'];
else $pasdemanuel="";
if(isset($_POST['superieur'])) $url=$_POST['superieur'];
else $superieur="";
if(isset($_POST['etudes'])) $url=$_POST['etudes'];
else $etudes="";
if(isset($_POST['annee2'])) $url=$_POST['annee2'];
else $annee2="";
if(isset($_POST['nomecolesuivie'])) $url=$_POST['nomecolesuivie'];
else $nomecolesuivie="";
if(isset($_POST['ville2'])) $url=$_POST['ville2'];
else $ville2="";
if(isset($_POST['nomprofesseur2'])) $url=$_POST['nomprofesseur2'];
else $nomprofesseur2="";
if(isset($_POST['travaille'])) $url=$_POST['travaille'];
else $travaille="";
if(isset($_POST['comboatelier'])) $url=$_POST['comboatelier'];
else $comboatelier="";
//On vérifie si les champs sont vides
if(empty($nom) OR empty($prenom) OR empty($telephone))
{
echo '<font color="red">Attention, seul le champs <b>rue</b> peut rester vide !</font>';
}
// Aucun champ n'est vide, on peut enregistrer dans la table
else
{
// connexion à la base
$db = mysql_connect('localhost', 'root', '') or die('Erreur de connexion '.mysql_error());
// sélection de la base
mysql_select_db('inscription',$db) or die('Erreur de selection '.mysql_error());
// on écrit la requête sql
$sql = "INSERT INTO bulletin(id, nom, prenom, date, rue, numero, codepostal, ville, telephone, mail, telurgence, remarque,
nomparticipant, prenomparticipant, dateparticipant, rueparticipant, numeroparticipant, codepostalparticipant,
villeparticipant, telephoneparticipant, mailparticipant, choixlangue, choixetudiant, branche,
comboannee, nomecole, villeecole, nomprofesseur, nommanuelsuivi, pasdemanuel, superieur, etudes, annee2,
nomecolesuivie, ville2, nomprofesseur2, travaille, comboatelier) VALUES('','$nom','$prenom','$date','$rue','$numero','$codepostal', '$ville',
'$telephone', '$mail', '$telurgence', '$remarque', '$nomparticipant', '$prenomparticipant', '$dateparticipant', '$rueparticipant',
'$numeroparticipant', '$codepostalparticipant', '$villeparticipant', '$telephoneparticipant', '$mailparticipant', '$choixlangue',
'$choixetudiant', '$branche', '$comboannee', '$nomecole', '$villeecole', '$nomprofesseur', '$nommanuelsuivi', '$pasdemanuel',
'$superieur', '$etudes', $annee2', '$nomecolesuivie', '$ville2', '$nomprofesseur2', '$travaille', '$comboatelier')";
// on insère les informations du formulaire dans la table
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());
// on affiche le résultat pour le visiteur
echo 'Vos infos on été ajoutées.';
mysql_close(); // on ferme la connexion
}
?> |
Partager