Deyhak Posted August 13, 2012 Share Posted August 13, 2012 I've been working on a sign up page, and encountered an issisue where no matter which field is empty, ALL of them are marked with red. Can someone help me solve that issiue? <?php $email_color = "BLACK"; $pw_color = "BLACK"; $f_name_color = "BLACK"; $l_name_color = "BLACK"; if (empty($_POST['pw']) && empty($_POST['email']) && empty($_POST['f_name']) && empty($_POST['l_name'])) { echo "Fill in your information:<br>"; } else { if (empty($P_POST['pw'])){ $pw_color = "RED"; } else { $pw = $_POST['pw']; if (strlen($pw) < 4 || strlen($pw) > 16) { echo "<br>Password must be between 4 to 16 characters"; $pw_color = "RED"; } } if (empty($P_POST['email'])){ $email_color = "RED"; } if (empty($P_POST['f_name'])){ $f_name_color = "RED"; } if (empty($P_POST['l_name'])){ $l_name_color = "RED"; } if (empty($_POST['pw']) || empty($_POST['email']) || empty($_POST['f_name']) || empty($_POST['l_name'])) { echo "There are missing fields!<br>"; } } ?> <html> <head> <title>Login</title> </head> <body> <form action = "index.php" method = "POST"> <Font Color = <?php echo "$f_name_color" ?>> First Name: <input type = "text" name = "f_name"> <br><br> </Font> <Font Color = <?php echo "$l_name_color" ?>> Last Name: <input type = "password" name = "l_name"> <br><br> </Font> <Font Color = <?php echo "$email_color" ?>> Email: <input type = "text" name = "email"> <br><br> </Font> <Font Color = <?php echo "$pw_color" ?>> Password: <input type = "password" name = "pw"> <br><br> </Font> <input type = "submit" name = "Submit" value = "Log In"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 13, 2012 Share Posted August 13, 2012 Probably because $P_POST is not the same as $_POST. Quote Link to comment Share on other sites More sharing options...
Deyhak Posted August 13, 2012 Author Share Posted August 13, 2012 Kill me now... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.