Validation d'un formulaire apres verification
elminster
-
giheller Messages postés 1960 Date d'inscription Statut Membre Dernière intervention -
giheller Messages postés 1960 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai un problème de verification de mon formulaire d'inscription sur un site.
Le formulaire se valide bien et passe à la page suivante inscription_2, mais il n'y a aucune vérification de mon formulaire
pensant que cela venait du bouton image à la place du bouton traditionnel "submit", j'ai essayé de le remplacer par un bouton "submit" classique mais même avec ca, il n'y a pas de vérification du formulaire...
ma verif porte sur la bonne structuration de l'adresse mail, la présence d'un pseudo, d'un département puis la verif de la présence des deux mots de passes et qu'ils soient bien identiques...
Est-ce que je me suis planté quelque part, je sais pas.. donc si quelqu'un a la possibilité de me dire ce qui pose pb (puisque pb il y a... et que j'avoue que je ne trouve pas malgré toutes mes tentatives), je ne pourrais que vous remercier.
voici la page php correspondante :
<? include ("connexion.php");
// pour me lier à ma base sql...
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>inscription</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function couleur(obj) {
obj.style.backgroundColor = "#FFFFFF";
}
function check() {
var msg = "";
if (document.inscription.email.value != "") {
indexAroba = document.inscription.email.value.indexOf('@');
indexPoint = document.inscription.email.value.indexOf('.');
if ((indexAroba < 0) || (indexPoint < 0)) {
document.inscription.email.style.backgroundColor = "#F3C200";
msg += "Le mail saisi est incorrect\n";
}
}
else {
document.inscription.email.style.backgroundColor = "#F3C200";
msg += "Veuillez saisir votre mail.\n";
}
if (document.inscription.pseudo.value == "") {
msg += "Veuillez saisir un pseudo\n";
document.inscription.pseudo.style.backgroundColor = "#F3C200";
}
if (document.inscription.departement.value == "") {
msg += "Veuillez indiquer un departement\n";
document.inscription.departement.style.backgroundColor = "#F3C200";
}
if (document.inscription.pays.value == "") {
msg += "Veuillez indiquer un departement\n";
document.inscription.pays.style.backgroundColor = "#F3C200";
}
if ((document.inscription.mdp1.value == "") || (document.inscription.mdp2.value == "") ) {
msg += "Veuillez saisir votre mot de passe deux fois\n";
document.inscription.mdp1.style.backgroundColor = "#F3C200";
document.inscription.mdp2.style.backgroundColor = "#F3C200";
}
if (document.inscription.mdp1.value <> document.inscription.mdp2.value) {
msg += "Les deux mots de passe saisis ne sont pas identiques. veuillez vérifier\n";
document.inscription.mdp1.style.backgroundColor = "#F3C200";
document.inscription.mdp2.style.backgroundColor = "#F3C200";
}
if (msg == "") return(true);
else {
alert(msg);
return(false);
}
}
</SCRIPT>
</head>
<body>
<P> </P>
<table width="80%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="22" height="22" background="images/contour_angle_haut_gauche.png"> </td>
<td height="22" background="images/contour_haut.png" > </td>
<td width="22" height="22" background="images/contour_angle_haut_droit.png"> </td>
</tr>
<tr>
<td width="22" background="images/contour_gauche.png" > </td>
<td bgcolor="#FFFFFF"
><table width="100%" border="0" cellspacing="0" cellpadding="0">
<? include ("menu.php"); ?>
<tr>
<td>
<form action="inscription_2.php" method="post" name="inscription" onSubmit="return check();">
<table align="center" width="100%" border="0">
<TR>
<TD colspan="2" width="33%" align="center"><img src="images/votre_compte.png" width="150" height="33"> </TD>
<TD colspan="2" width="34%" align="center"><img src="images/vous_desactive.png" width="150" height="33"></TD>
<TD colspan="2" width="33%" align="center"><img src="images/votre_recherche_desactive.png" width="150" height="33"> </TD>
</TR>
<TR>
<TD colspan="6">
<div align="left"><strong>Saisissez ici vos coordonnées</strong>
</div>
<table width="100%" border="0" align="center">
<TR>
<TD>Votre Pseudo<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="pseudo" type="text" onKeyUp="javascript:couleur(this);"> <input name="confid" type="checkbox" value="1" checked disabled>
(coordonnéees confidentielles)
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Votre departement<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6">
<select name="departement" onKeyUp="javascript:couleur(this);">
<?php $depart = "SELECT * FROM departements ORDER BY id_departement";
$depar = mysql_query ($depart, $connect);
while ($depa = mysql_fetch_row ($depar))
{ ?>
<option value="<?php echo $depa[0] ?>" selected ><?php echo "$depa[0] - $depa[1]"; ?></option>
<?php } ?>
</select>
pays<span class="Style3">*</span> : <select name="pays" onKeyUp="javascript:couleur(this);">
<?php $paysss = "SELECT * FROM pays ORDER BY id_pays";
$payss = mysql_query ($paysss, $connect);
while ($pays = mysql_fetch_row ($payss))
{ ?>
<option value="<?php echo $pays[0] ?>"><?php echo $pays[1]; ?></option>
<?php } ?>
</select>
</TD>
</TR>
<TR>
<TD> Votre email<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="email" type="text" onKeyUp="javascript:couleur(this);">
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Mot de Passe<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6"><input name="mdp1" type="password" onKeyUp="javascript:couleur(this);">
</TD>
</TR>
<TR>
<TD>Saisir à nouveau Mot de Passe<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="mdp2" type="password" onKeyUp="javascript:couleur(this);"> <input name="categ" type="hidden" value="1"> <input name="group" type="hidden" value="1"><input name="susp" type="hidden" value="0"><input name="resil" type="hidden" value="0">
</TD>
</TR>
<TR>
<TD colspan="6"><em>les champs marqués d'une <span class="Style3">*</span> sont obligatoires.
</em></TD>
</TR>
<TR>
<TD>
<p><em>Facultatif : </em></p></TD>
<TD colspan="5" align="left"> </TD>
</TR>
<TR>
<TD>Votre Nom :
</TD>
<TD colspan="5" align="left"><input name="nom" type="text">
<input name="masque" type="checkbox" value="1" checked disabled>
(masquer nom & prénom sur le site)
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Votre Prénom :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6"><input name="prenom" type="text"> </TD>
</TR>
</table>
</TD>
</TR>
<TR>
<TD colspan="5" align="right"><img src="images/etape_precedente_desactive.png" width="150" height="33"></TD>
<TD align="center"><input type="image" name="submit" src="images/etape_suivante.png" width="150" height="33" onclick="this.form.submit();">
</TD>
</TR>
</table>
</form>
</TD>
</tr>
<tr>
<td><? echo $hits; echo " visiteurs"; ?></td>
</tr>
</table></td>
<td width="22" background="images/contour_droite.png" > </td>
</tr>
<tr>
<td width="22" height="22" background="images/contour_angle_bas_gauche.png"> </td>
<td height="22" background="images/contour_bas.png" > </td>
<td width="22" height="22" background="images/contour_angle_bas_droit.png"> </td>
</tr>
</table>
</body>
</html>
j'ai un problème de verification de mon formulaire d'inscription sur un site.
Le formulaire se valide bien et passe à la page suivante inscription_2, mais il n'y a aucune vérification de mon formulaire
pensant que cela venait du bouton image à la place du bouton traditionnel "submit", j'ai essayé de le remplacer par un bouton "submit" classique mais même avec ca, il n'y a pas de vérification du formulaire...
ma verif porte sur la bonne structuration de l'adresse mail, la présence d'un pseudo, d'un département puis la verif de la présence des deux mots de passes et qu'ils soient bien identiques...
Est-ce que je me suis planté quelque part, je sais pas.. donc si quelqu'un a la possibilité de me dire ce qui pose pb (puisque pb il y a... et que j'avoue que je ne trouve pas malgré toutes mes tentatives), je ne pourrais que vous remercier.
voici la page php correspondante :
<? include ("connexion.php");
// pour me lier à ma base sql...
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>inscription</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function couleur(obj) {
obj.style.backgroundColor = "#FFFFFF";
}
function check() {
var msg = "";
if (document.inscription.email.value != "") {
indexAroba = document.inscription.email.value.indexOf('@');
indexPoint = document.inscription.email.value.indexOf('.');
if ((indexAroba < 0) || (indexPoint < 0)) {
document.inscription.email.style.backgroundColor = "#F3C200";
msg += "Le mail saisi est incorrect\n";
}
}
else {
document.inscription.email.style.backgroundColor = "#F3C200";
msg += "Veuillez saisir votre mail.\n";
}
if (document.inscription.pseudo.value == "") {
msg += "Veuillez saisir un pseudo\n";
document.inscription.pseudo.style.backgroundColor = "#F3C200";
}
if (document.inscription.departement.value == "") {
msg += "Veuillez indiquer un departement\n";
document.inscription.departement.style.backgroundColor = "#F3C200";
}
if (document.inscription.pays.value == "") {
msg += "Veuillez indiquer un departement\n";
document.inscription.pays.style.backgroundColor = "#F3C200";
}
if ((document.inscription.mdp1.value == "") || (document.inscription.mdp2.value == "") ) {
msg += "Veuillez saisir votre mot de passe deux fois\n";
document.inscription.mdp1.style.backgroundColor = "#F3C200";
document.inscription.mdp2.style.backgroundColor = "#F3C200";
}
if (document.inscription.mdp1.value <> document.inscription.mdp2.value) {
msg += "Les deux mots de passe saisis ne sont pas identiques. veuillez vérifier\n";
document.inscription.mdp1.style.backgroundColor = "#F3C200";
document.inscription.mdp2.style.backgroundColor = "#F3C200";
}
if (msg == "") return(true);
else {
alert(msg);
return(false);
}
}
</SCRIPT>
</head>
<body>
<P> </P>
<table width="80%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="22" height="22" background="images/contour_angle_haut_gauche.png"> </td>
<td height="22" background="images/contour_haut.png" > </td>
<td width="22" height="22" background="images/contour_angle_haut_droit.png"> </td>
</tr>
<tr>
<td width="22" background="images/contour_gauche.png" > </td>
<td bgcolor="#FFFFFF"
><table width="100%" border="0" cellspacing="0" cellpadding="0">
<? include ("menu.php"); ?>
<tr>
<td>
<form action="inscription_2.php" method="post" name="inscription" onSubmit="return check();">
<table align="center" width="100%" border="0">
<TR>
<TD colspan="2" width="33%" align="center"><img src="images/votre_compte.png" width="150" height="33"> </TD>
<TD colspan="2" width="34%" align="center"><img src="images/vous_desactive.png" width="150" height="33"></TD>
<TD colspan="2" width="33%" align="center"><img src="images/votre_recherche_desactive.png" width="150" height="33"> </TD>
</TR>
<TR>
<TD colspan="6">
<div align="left"><strong>Saisissez ici vos coordonnées</strong>
</div>
<table width="100%" border="0" align="center">
<TR>
<TD>Votre Pseudo<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="pseudo" type="text" onKeyUp="javascript:couleur(this);"> <input name="confid" type="checkbox" value="1" checked disabled>
(coordonnéees confidentielles)
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Votre departement<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6">
<select name="departement" onKeyUp="javascript:couleur(this);">
<?php $depart = "SELECT * FROM departements ORDER BY id_departement";
$depar = mysql_query ($depart, $connect);
while ($depa = mysql_fetch_row ($depar))
{ ?>
<option value="<?php echo $depa[0] ?>" selected ><?php echo "$depa[0] - $depa[1]"; ?></option>
<?php } ?>
</select>
pays<span class="Style3">*</span> : <select name="pays" onKeyUp="javascript:couleur(this);">
<?php $paysss = "SELECT * FROM pays ORDER BY id_pays";
$payss = mysql_query ($paysss, $connect);
while ($pays = mysql_fetch_row ($payss))
{ ?>
<option value="<?php echo $pays[0] ?>"><?php echo $pays[1]; ?></option>
<?php } ?>
</select>
</TD>
</TR>
<TR>
<TD> Votre email<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="email" type="text" onKeyUp="javascript:couleur(this);">
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Mot de Passe<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6"><input name="mdp1" type="password" onKeyUp="javascript:couleur(this);">
</TD>
</TR>
<TR>
<TD>Saisir à nouveau Mot de Passe<span class="Style3">*</span> :
</TD>
<TD colspan="5" align="left"><input name="mdp2" type="password" onKeyUp="javascript:couleur(this);"> <input name="categ" type="hidden" value="1"> <input name="group" type="hidden" value="1"><input name="susp" type="hidden" value="0"><input name="resil" type="hidden" value="0">
</TD>
</TR>
<TR>
<TD colspan="6"><em>les champs marqués d'une <span class="Style3">*</span> sont obligatoires.
</em></TD>
</TR>
<TR>
<TD>
<p><em>Facultatif : </em></p></TD>
<TD colspan="5" align="left"> </TD>
</TR>
<TR>
<TD>Votre Nom :
</TD>
<TD colspan="5" align="left"><input name="nom" type="text">
<input name="masque" type="checkbox" value="1" checked disabled>
(masquer nom & prénom sur le site)
</TD>
</TR>
<TR>
<TD bgcolor="#E6E6E6">Votre Prénom :
</TD>
<TD colspan="5" align="left" bgcolor="#E6E6E6"><input name="prenom" type="text"> </TD>
</TR>
</table>
</TD>
</TR>
<TR>
<TD colspan="5" align="right"><img src="images/etape_precedente_desactive.png" width="150" height="33"></TD>
<TD align="center"><input type="image" name="submit" src="images/etape_suivante.png" width="150" height="33" onclick="this.form.submit();">
</TD>
</TR>
</table>
</form>
</TD>
</tr>
<tr>
<td><? echo $hits; echo " visiteurs"; ?></td>
</tr>
</table></td>
<td width="22" background="images/contour_droite.png" > </td>
</tr>
<tr>
<td width="22" height="22" background="images/contour_angle_bas_gauche.png"> </td>
<td height="22" background="images/contour_bas.png" > </td>
<td width="22" height="22" background="images/contour_angle_bas_droit.png"> </td>
</tr>
</table>
</body>
</html>
A voir également:
- Validation d'un formulaire apres verification
- Whatsapp formulaire opposition - Guide
- Formulaire de réclamation facebook compte désactivé - Guide
- Formulaire de reclamation instagram - Guide
- Temps validation annonce le bon coin - Forum Hotmail / Outlook.com
- Impossible d'utiliser ce numéro de téléphone pour la validation - Forum Gmail