// add.php - ajouter un nouveau participant
?>
|
Vous pouvez vous préincrire ici : * champs obligatoires |
// form not yet submitted
// display initial form
if (!$submit)
{
?>
}
else
{
// includes
include("./conf.php");
include("./functions.php");
// set up error list array
$errorList = array();
$count = 0;
// validate text input fields
if (!$nom) { $errorList[$count] = "Entre ton NOM STP"; $count++; }
if (!$prenom) { $errorList[$count] = "Entre ton prénom STP"; $count++; }
if (!$email) { $errorList[$count] = "Entre ton adresse email ou celle d'une copine ou d'un copain STP"; $count++; }
// check for errors
// if none found...
if (sizeof($errorList) == 0)
{
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "INSERT INTO bsclanparticipants(nom, prenom, pseudo, majorite, Email, Adresse, CP, Ville, timestamp) VALUES('$nom', '$prenom', '$pseudo', '$majorite' , '$email' , '$adresse' , '$cp' , '$ville' , NOW())";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// print result
echo "Mise à jour réussie. Retour.";
// close database connection
mysql_close($connection);
}
else
{
// errors found
// print as list
echo "Attention !!!:
";
echo "";
for ($x=0; $x$errorList[$x]";
}
echo "
";
}
}
?>
copyright © BSC LAN, 2003. All rights reserved.
|