Jump to content

Something is wrong here


Deyhak

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.