J'ai un petit problème pour la vérification d'un formulaire php
J'utilise le code php pour 2 différents formulaire
if($_POST['name']==""){
$answer = 'Indicate your name please. Thank<p><a href="index.php?page=2">Go Back</a>';
}
elseif($_POST['email']==""){
$answer = 'Indicate your correct email. Thank<p><a href="index.php?page=2">Go Back</a>';
}
elseif($_POST['subject']==""){
$answer = 'Indicate the subject of message please. Thank<p><a href="index.php?page=2">Go Back</a>';
}
elseif($_POST['message']==""){
$answer = 'Write your message please. Thank<p><a href="index.php?page=2">Go Back</a>';
}
else {
//INSERTION DANS LA TABLE
mysql_query ("INSERT INTO contact(id,name,email,subject,message,date) VALUES('','$name','$email','$subject','$message','$date')")or die ('Cannot select the database because: ' . mysql_error());
$answer = 'Your message have been sent correctly. We will answer your request as soon as possible.';
}
OK Ca marche. Maintenant, j'utilise la meme formule pour un autre formulaire destiné à l'ouverture d'un compte utilisateur, ca fonctionne pas!!! A savoir:
if($_POST['$account']==""){
$answer = 'Select an Account please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$myusername']==""){
$answer = 'Indicate your correct email. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$mypassword']==""){
$answer = 'Select a password please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$firstname']==""){
$answer = 'Write your firstname please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$lastname']==""){
$answer = 'Write your lastname please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q1']==""){
$answer = 'Answer to the question #1 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q2']==""){
$answer = 'Answer to the question #2 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q3']==""){
$answer = 'Answer to the question #3 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q4']==""){
$answer = 'Answer to the question #4 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q5']==""){
$answer = 'Answer to the question #5 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q6']==""){
$answer = 'Answer to the question #6 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
elseif($_POST['$Q7']==""){
$answer = 'Answer to the question #7 please. Thank<p><a href="index.php?page=1">Go Back</a>';
}
//RECHERCHE COMPTE IDENTIQUE
$sql="SELECT * FROM $tbl_name WHERE myusername='$myusername'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
//INSERTION VALEUR
if($count==0){
mysql_query("INSERT INTO $tbl_name VALUES('','$account','$myusername','$mypassword','$firstname','$lastname','$Q1','$Q2','$Q3','$Q4','$Q5','$Q6','$Q7')") or die(mysql_error());
session_register("myusername");
session_register("mypassword");
$answer = '<b><font face="Arial,Helvetica"><font size=+2>Congratulation!</font></font></b><p><br>Your user account is open now.</font></b><p>Thank you !';
}
else {
$answer = 'This email is already in our database. <p><a href="index.php?page=1">Go Back</a>';
}
L'insertion fonctionne , mais c'est la vérification. Le script se comporte en ignorant la vérification. Auriez vous une idée sur ce qui cloche? Merci