Sorry I just woke up and there are all of the disparate responses?! 
I'm not understanding what everyone is saying?!
Should I post more of my code?
I debugged this in Netbeans last night and the variable held FALSE yet it took the wrong branch in my IF-THEN-ELSE.
Here is more of my code...
My code:
Code:
<?php
//This page processes...
// Address error-handling.
error_reporting(E_ALL & ~E_NOTICE);
// Start output buffering.
ob_start();
// Initialize a session.
session_start();
// Define variables.
$email = $_POST['email'];
$new_cust = $_POST['new_cust'];
$password1 = $_POST['password1'];
$submitted = $_POST['submitted'];
echo 'email = ' . $email . "<br />";
echo 'new_cust = ' . $new_cust . "<br />";
echo 'password1 = ' . $password1 . "<br />";
echo 'submitted = ' . $submitted . "<br />";
// Initialize $errors array
$errors= array();
if (isset($submitted)) {
// Handle the form.
if ($new_cust == TRUE) {
// For New Customers
if(empty($email)) {
$errors['email']='Please enter a valid E-mail address.';
};
} else {
// For Existing Customers
if(empty($email)) {
$errors['email']='Please enter a valid E-mail address.';
};
if(empty($password1)) {
$errors['password1']='Please enter your Password valid E-mail address.';
};
}
}
/*
if(empty($errors)) {
//validation success
//send email, save to db ...
header('Location: thankyou.html');
}
*/
ob_end_flush();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>Sign-In/Create Account</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!--<link rel="stylesheet" type="text/css" href="tabs.css" />-->
<style type="text/css">
/* DEV: Identify Element Edges */
/*
* {
border: 1px dotted #FF0000;
}
*/
html,
body {
margin: 0px;
padding: 0px;
background-color: #FFFFFF; /* White */
font-family: Arial, Helvetica, sans-serif;
font-size: 1em; /*0.8em/1.8em*/
color: #000000; /* Black */
}
#wrapper {
overflow: hidden; /* Helps to "contain" floated children. */
width: 850px;
margin: 70px Auto;
padding: 50px;
border: 1px solid #808080;
}
#header {
float: left;
width: 100%;
margin: 0em 0em 1em 0em;
padding: 0em;
font-size: 1.4em;
font-weight: bold;
}
#content {
clear: both;
}
#content h2 {
margin: 0px 0px -2px 0px;
font-size: 1em;
color: #FF6600;
}
p {
margin: 0 0 1em;
font-size: 0.8em;
}
/* PAGE CONTENT STYLES */
form {
padding: 0px 0px 0px 150px; /* padding: 0px 0px 0px 200px */
}
ol {
margin: 0px;
padding: 0px 0px 30px 20px;
list-style-type: lower-alpha;
}
.step {
margin: 14px 0px 0px 0px;
}
label {
display: block;
padding: 0px 0px 5px 0px;
font-weight: bold;
}
input {
/*
display: block;
*/
font-size: 1em;
}
.cust_status label {
display: inline;
padding: 0px 0px 5px 0px;
font-weight: normal;
}
.cust_status input {
display: inline;
font-size: 1em;
}
.proceed {
margin: 14px 0px 20px 20px;
}
a {
outline: none;
font-size: 0.8em;
}
.error {
color: #FF0000;
padding: 0px 0px 0px 20px;
}
</style>
</head>
<body>
<div id="wrapper">
<!--#################### PAGE HEADER ####################-->
<div id="header">
STEP 2: Sign-In/Create Account
</div>
<!--#################### PAGE CONTENT ####################-->
<div id="content">
<h2>Registering is quick and easy...</h2>
<!-- LOG-IN FORM -->
<!-- <form action="104_CreateUser.xhtml" method="post"> -->
<form action="103_SignIn.php" method="post">
<ol>
<!-- a.) E-MAIL ADDRESS -->
<li class="step">
<label for="email">Enter your e-mail address:</label>
<input id="email" type="text" name="email" size="30" maxlength="80" />
<?php if(isset($errors['email'])) {
echo '<span class="error">' . $errors['email'] . "</span>";
} ?>
</li>
<!-- b.) CUSTOMER STATUS -->
<li class="step">
<label for="radio">Choose a customer status:</label>
<div class="cust_status" id="radio">
<div>
<input id="new_cust" type="radio" name="new_cust" value="TRUE" checked="checked"/>
<label for="new_cust">I'm a new customer</label>
</div>
<div>
<input id="ret_cust" type="radio" name="new_cust" value="FALSE" />
<label for="ret_cust">I'm a returning customer</label>
</div>
</div>
</li>
<!-- c.) PASSWORD -->
<li class="step">
<label for="password">Returning customers, what is your password?</label>
<input id="password" type="password" name="password1" size="20" maxlength="20" />
<?php if(isset($errors['password1'])) {
echo '<span class="error">' . $errors['password1'] . "</span>";
} ?>
</li>
</ol>
<div>
<!-- HIDDEN INPUT -->
<input type="hidden" name="submitted" value="TRUE" />
<!-- PROCEED BUTTON -->
<input type="image" src="images/Proceed.jpg"
alt="Proceed" class="proceed" border="0" /><br />
<!-- FORGOT PASSWORD LINK -->
<a href="#" class="proceed">Help, I Forget My Password?!</a>
</div>
</form>
</div>
</div>
</body>
</html>
Testing:
If I run the form, select "I am a returning customer" (i.e. New Customer = FALSE), and leave Email and Password blank, I expect to see...
Please enter a valid E-mail address.
Please enter your Password.
However my code is taking the wrong path even though new_cust = FALSE in NetBeans.
It is taking this path...
if (isset($submitted)) {
// Handle the form.
if ($new_cust == TRUE) {
// For New Customers
if(empty($email)) {
$errors['email']='Please enter a valid E-mail address.';
};
Amy
Bookmarks