Need help with my code.
I have this code below, i need the bottom part not to display if there are to conditions that apply.
1. the submit button was hit
2. there are no messages to display look at it I know i should use some is statements but I can't seem to get them to work. Any help would be great thanks.
PHP:<?php
include "header.php";
include("include/common.php");
if($_POST["submit"]){
field_validator("First Name", $_POST["first_name"], "alphanumeric", 4, 15);
}
if(empty($messages)) {
$sql2 = "INSERT INTO customer (id, first_name)
VALUES (NULL, '$first_name')";
//start display
echo "Your information has been entered into the database.";
$query2 = "SELECT id, first_name FROM customer WHERE id LIKE '$id'";
$result2 = mysql_query($query2) or die("ERROR");
list($id, $first_name) = mysql_fetch_row($result2);
echo "$first_name";
//end display
}
}
?>
//*************************************************
// from here down should not display it the form was submitted and there are no messages to display.
//*************************************************
<TABLE width="540" BORDER="0">
<TR>
<TD align="CENTER" class="m">Signup To Become A Member</TD>
</TR>
<TR>
<TD>
<?php
if(!empty($messages)){
displayErrors($messages);
echo "<h4>Make sure Gender & Newsletter are selected.</h4><br><br>";
}else{
echo "<center><br><H1>Signup To Become A Member</H1><br></center><br> ";
}
$serverdate = date("m-d-y");
?>
<table border="0" width="80%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td>
<FORM name="signup_cmo" ACTION="<? echo "$PHP_SELF"; ?>" METHOD=POST>
<table border="0" cellpadding="0" cellspacing="0" width="91%">
<tr>
<td bordercolor="#000000">First Name:</td><td><?php print $_POST[""] ?>
<input type="text" name="first_name" value="<?php print $_POST["first_name"] ?>" size="20" class="text"></td>
</tr>
<tr>
<td><br><input type="submit" value="Submit" name="submit" color: #000000; border: 1 solid #000000" class="button"></td><td>
<input type="reset" value="Reset" name="B2" color: #000000; border: 1 solid #000000" class="button"></td>
</tr>
<tr>
</form></tr></table> </div></td> </tr></table>
</td>
</tr>
</TABLE>
</TD>
</TR>
</TABLE></TD></TR></TABLE>
<?php include "footer.php"; ?>
___________________
We are survival machines - robot vehicles blindly programmed to preserve the selfish molecules known as genes.
- Richard Dawkins


