I have created a form that checks whether the name and email forms have been filled in.
if(isset($_POST['checker']))
{
if(isset($_POST['nameStr']))
{
$name = cleaninput($_POST['nameStr']);
}else {
echo "<p>You failed to enter your name.</p>";
}
if(isset($_POST['emailStr']))
{
$email = cleaninput($_POST['emailStr']);
}else {
echo "<p>You failed to enter your email.</p>";
}
if($name && $email == TRUE)
{
echo insertdata($name, $email);
}else {
echo "<p>There was an error. Please enter your details again</p>";
}
}
However, the "else" code that tests whether it is set or not doesn't execute. What happens is, when I submit the empty fields the last "else" runs when I am testing that $name and $email == TRUE. Why does the the error trapping get missed on the testing for the individual name and email?

New Topic/Question
Reply




MultiQuote





|