This essentially checks if any of these if
statements are true, then echos a statement.
Unfortunately, wrapping the error message with a div
tag is impossible since I set error to 1 after I would have the div tag show up. I assume I could use a function for this but I don't understand how they work.
Is there a better way to check all these parameters then return a string that I can check if something exists in that string or not to post?
if ($error == '1'){ echo '<div class="error_message">';}
if(strlen($display)<4)
{
echo "Display name is too short. <br>";
$error = '1';
}
if ($email == '')
{
echo "You did not put a valid email adress. We require this to verify your account. <br>";
$error = '1';
}
if(mysql_num_rows($check_display) != 0)
{
echo "Display name is already in use. <br>";
$error = '1';
}
if(mysql_num_rows($check_user) != 0)
{
echo "Username is already in use. <br>";
$error = '1';
}
if(mysql_num_rows($check_mail) != 0)
{
echo "Email is already in use. <br>";
$error = '1';
}
if ($pass != $pass2)
{
echo 'Passwords do not match. <br>' ;
$error = '1';
}
if ($error == '1'){ echo '</div>';}
mysql_*
functions in new code! \$\endgroup\$