salut!
je souhaite proteger mes champs lors de l'inscription des client
alors j'utilise en plus de php, js pour avoir des msg box.
mais mon 1er pb; que j'arrive pas à avoir une alert sur chaque champs non valide et par ordre
et en plus de cela je doit utilser un autre form pour excuter la fonctoin choix() (c'est un choix que le client doit faire avant de remplir la formulaire) ma question est ce que on peut avoir deux form sur un meme fichier html?
voila une partie de mon code: et merci
<html>
<head>
<title>Ma première page en PHP</title>
<script language="javascript">
function Verif()
{
if (document.formulaire1.nom.value == '' || document.formulaire1.prenom.value == '')
alert('le champs Nom et Prenom sont obligatoire');
if(document.formulaire1.tel.value == '')
alert('le tel ');
else
document.formulaire1.submit();
}
function choix()
{
if(document.formulaire2.url.value!="Vide")
{
document.location=document.formulaire2.url.value;
}
}
</script>
</head>
<body>
<br><br><br><br>
<form name="formulaire1" action="adherent.php" method="post">
<center>
<table width="300" border="1" bordercolor="#000000" cellspacing="0" cellpadding="2">
<tr>
<td width=""><p>Nom</p></td>
<td width=""><input type="text" name="nom" size="50" ></td>
</tr>
<tr>
<td width=""><p>Prenom</p></td>
<td width=""><input type="text" name="prenom" size="50" ></td>
</tr>
<tr>
<td width=""><p>Date de naissance</p></td>
<td width=""><input type="text" name="dateNaissance" value="AAAA-MM-JJ" size="50"></td>
</tr>
<tr>
<td width=""><p>Tél</p></td>
<td width=""><input type="text" name="tel" size="50"></td>
</tr>
<tr>
<td width=""><p>Fax</p></td>
<td width=""><input type="text" name="fax" size="50"></td>
</tr>
<tr>
<td width=""><p>e-mail</p></td>
<td width=""><input type="text" name="email" size="50" ></td>
</tr>
<tr>
<td width=""><p>Adresse</p></td>
<td width=""><input type="text" name="adresse" size="50"></td>
</tr>
<tr>
<td width=""><p>StatutPersonne</p></td>
<td width=""><input type="text" name="statutPersonne" size="50"></td>
</tr>
<tr>
<td width=""><p>StatutAdhesion</p></td>
<td><input type="text" name="statutAdhesion" size="50"></td>
</tr>
<tr>
<td colspan="2"><div align="right">
<center>
<input type="button" value="Valider" onClick="Verif();" >
<input type="reset" name="Reset" value="Effacer">
</center>
</td>
</tr>
</table>
</form>
</center>
<center>
<FORM name="formulaire2" method="POST">
<select size="1" name="url" onChange="choix()">
<option value="Vide">Votre statut</option>
<option value="organisme1.html">Organisme</option>
<option value="adherent1.html">Personne</option>
</center>
</select>
<br><br>
<center><a href="identif.html">S'identifier</a></center>
</body>
</html>