Download
<html>
<body>
<form method="post" action="inscription.php">
<h1>Inscription Membres</h1>
<table>
<tr>
<td><b>Nom:</b></td>
<td>
<input type="text" name="nom"></td>
</tr>
<tr>
<td><b>Prénom:</b></td>
<td>
<input type="text" name="prenom"></td>
</tr>
<tr>
<td><b>username:</b></td>
<td>
<input type="text" name="username"></td>
</tr>
<tr>
<td><b>Mot de passe:</b></td>
<td>
<input type="password" name="password"></td>
</tr>
<tr>
<td><b>Email:</b></td>
<td>
<input type="text" name="email"></td>
</tr>
<tr>
<td>Adresse</td>
<td>
<input type="text" name="adresse"></td>
</tr>
<tr>
<td>Pays:</td>
<td>
<input type="text" name="pays"></td>
</tr>
<tr>
<td>
<input type="submit" value="Envoyer"></td>
<td>
<input type="reset" value="Affacer le formulaire"></td>
</tr>
</form>
</body>
</html>
--------------------------------Script-----------------------------------
<!-- inscription.php
<?php
// A copier dans un fichier different nommé inscription.php
function validate_form(){
global $username, $nom, $prenom, $email, $password;
$erreurs=0;
if (!trim($username))
{
echo "<b>Nom d'utilisateur</b> est obligatoire.";
$erreurs++;
}
if (!trim($nom))
{
echo "<b>Nom/B> est obligatoire.";
$erreurs++;
}
if (!trim($prenom))
{
echo "Le champs <b>Prénom </b> est obligatoire.";
$erreurs++;
}
if (!trim($email))
{
echo "Le champs <b>email</b> est obligatire.";
$erreurs++;
}
if (!trim($password))
{
echo "Le champs <b>Mot de passe</b> est obligatire.";
$erreurs++;
}
switch ($erreurs){
case 0:
return TRUE;
default:
echo "
Cliquez sur le bouton précedent ";
echo " du navigateur pour corriger ces erreurs ";
echo "Ensuite cliquez sur le bouton envoyer ";
return FALSE;
}
}
$ok = validate_form();
if ($ok)
{
// insérer les données dans la base de données
}
?>
--> |
<html>
<body>
<form method="post" action="inscription.php">
<h1>Inscription Membres</h1>
<table>
<tr>
<td><b>Nom:</b></td>
<td>
<input type="text" name="nom"></td>
</tr>
<tr>
<td><b>Prénom:</b></td>
<td>
<input type="text" name="prenom"></td>
</tr>
<tr>
<td><b>username:</b></td>
<td>
<input type="text" name="username"></td>
</tr>
<tr>
<td><b>Mot de passe:</b></td>
<td>
<input type="password" name="password"></td>
</tr>
<tr>
<td><b>Email:</b></td>
<td>
<input type="text" name="email"></td>
</tr>
<tr>
<td>Adresse</td>
<td>
<input type="text" name="adresse"></td>
</tr>
<tr>
<td>Pays:</td>
<td>
<input type="text" name="pays"></td>
</tr>
<tr>
<td>
<input type="submit" value="Envoyer"></td>
<td>
<input type="reset" value="Affacer le formulaire"></td>
</tr>
</form>
</body>
</html>
--------------------------------Script-----------------------------------
<!-- inscription.php
<?php
// A copier dans un fichier different nommé inscription.php
function validate_form(){
global $username, $nom, $prenom, $email, $password;
$erreurs=0;
if (!trim($username))
{
echo "<b>Nom d'utilisateur</b> est obligatoire.";
$erreurs++;
}
if (!trim($nom))
{
echo "<b>Nom/B> est obligatoire.";
$erreurs++;
}
if (!trim($prenom))
{
echo "Le champs <b>Prénom </b> est obligatoire.";
$erreurs++;
}
if (!trim($email))
{
echo "Le champs <b>email</b> est obligatire.";
$erreurs++;
}
if (!trim($password))
{
echo "Le champs <b>Mot de passe</b> est obligatire.";
$erreurs++;
}
switch ($erreurs){
case 0:
return TRUE;
default:
echo "
Cliquez sur le bouton précedent ";
echo " du navigateur pour corriger ces erreurs ";
echo "Ensuite cliquez sur le bouton envoyer ";
return FALSE;
}
}
$ok = validate_form();
if ($ok)
{
// insérer les données dans la base de données
}
?>
-->