THis is driving me insane!!!
It was just working perfect a few hours ago! and i swear not much has changed in the code...
I am feeding this script 2 variables via $_POST 'terms' and 'email'
If the email address is found in the database it is suposed to pre-fill the form... and it does!
But if i enter a new email address the page simply goes blank... nothing happens...
It was just working cause thats how i populated the database in the first place... now it doesn't work!!
I'm going insane, Please help if you can. Thank-you so much!
<?php
//Make Sure They have agreed to terms
if (!isset($_POST["terms"])){
// Enter Error Check
echo "Please Read terms and Check the box if you Agree";
include 'step2.php';
exit;
}else{
// Create Session for Terms
$_SESSION['terms'] = $_POST['terms'];
//include("includes/header.inc");
// Collect Email Address From Prvious Script(step2)
$_SESSION['email'] = $_POST['email'];
// Check if email is Valid
$validEmailExpr = "^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*" . "@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*$";
if (!eregi($validEmailExpr, $_POST['email'])){
// The email must match the above regular expression
// Open Session to make it possible to send error msg to user on page with the mistake.
if (!session_is_registered("errors"))
session_register("errors");
// Msg to Show User
$_SESSION['errors'] = "E-mail Syntax is Incorrect";
// Send them to the page to fix Error
include 'step2.php';
exit;
}
// MySQL Connection Variables
$hostName = 'localhost'; // MySQL Host Name: 'localhost' Unless Database is on another Server
$databaseName = 'bla'; // Name Of MYSQL Database
$username = 'bla'; // MySQL UserName
$password = 'bla'; // MySQL UserName
// Connection to Mysql
$connection = @ mysql_pconnect($hostName, $username, $password) or die(mysql_error());
$db = mysql_select_db($databaseName, $connection) or die(mysql_error());
// Is This a New User? Or Previous
// Check database for email
$email_check_sql = mysql_query("SELECT email FROM attendees WHERE email='" . $_POST['email'] . "'") or die(mysql_error());
$email_check = mysql_num_rows($email_check_sql) or die(mysql_error());
if($email_check > 0){
// User has Registered Before - Show Pre-Filled Form
// Collect User Information from database
$collect_data = mysql_query("SELECT * FROM attendees WHERE email='". $_POST['email'] . "'") or die(mysql_error());
// Pull out data and store in an array 'usrVars'. Any Information in Database will now be displayed in form.
$usrVars = mysql_fetch_array($collect_data) or die(mysql_error());
// Gotta Break Apart the Users DOB- Cause it's Whole in the database
// String is in Mysql Format YYYY-MM-DD...
$string = $usrVars['age'];
// So we gotta EXPLODE it
$dob = explode("-", $string);
/*
$dob_str = $dob[2] ."-". $dob[1] ."-". $dob[0]; // Now It's All Seperated
echo $dob_str;
*/
}// End If
} // End Else
// Show Registration Form
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<CENTER>
<FORM METHOD="post" ACTION="ins_attendee.php">
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=10 WIDTH="675">
<TR><TD ALIGN="center" VALIGN="top" WIDTH="675" BGCOLOR="#212C70">
<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0 WIDTH="100%" BGCOLOR="#ffffff">
<TR>
<TD ALIGN="left" VALIGN="top" COLSPAN=2 WIDTH="100%" BGCOLOR="#212C70">
<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%">
<TR>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#c0c0c0"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#909090"><B>Step 1</B></FONT></TD>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#c0c0c0"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#909090">Step 2</FONT></TD>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#333366"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#FFFFFF">Step 3</FONT></TD>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#CCCCCC"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#999999">Step 4</FONT></TD>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#c0c0c0"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#909090">Step 5</FONT></TD>
<TD ALIGN="center" VALIGN="top" BGCOLOR="#c0c0c0"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#909090">Step 6</FONT></TD>
</TR></TABLE></TD>
</TR>
<TR>
<TD ALIGN="center" VALIGN="top" COLSPAN=2 BGCOLOR="#000000"><FONT FACE="Arial, Helvetica" SIZE="-1" COLOR="#ffffff"><B>Contact Information</B></FONT></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top" COLSPAN=2><FONT FACE="Verdana" SIZE="-1">Please provide the following contact information. This information is required so that we can get in contact with you regarding the next event. If you omit any details it will just slow your registration process.</FONT></TD>
</TR>
<td height="86"><TR>
<TD ALIGN="left" VALIGN="top" COLSPAN=2 WIDTH="675">
<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH="100%">
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>First Name:</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><INPUT NAME="firstname" TYPE="TEXT" value="<?php echo $usrVars['firstname']; ?>" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>Last Name:</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><INPUT NAME="lastname" TYPE="TEXT" value="<?php echo $usrVars['lastname']; ?>" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>Handle / Alias:</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><INPUT NAME="alias" TYPE="TEXT" value="<?php echo $usrVars['alias']; ?>" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Date
of Birth:</strong></font></TD>
<TD ALIGN="left" VALIGN="top"><input name="month" type="text" value="<? echo $dob[1]; ?>" size="2" maxlength="2">/<input name="day" type="text" value="<? echo $dob[2]; ?>" size="2" maxlength="2">/<input name="year" type="text" value="<? echo $dob[0]; ?>" size="4" maxlength="4"></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>Postal Address:</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><INPUT NAME="address1" TYPE="TEXT" value="<?php echo $usrVars['address1']; ?>" SIZE="50">
<BR>
<INPUT NAME="address2" TYPE="TEXT" value="<?php echo $usrVars['address2']; ?>" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>City/Province:</B></FONT></TD>
....... I deleted a bunch of html here so it would fit in the post!!! ......
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>Zip/Postal Code:</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><INPUT NAME="zip" TYPE="TEXT" value="<?php echo $usrVars['zip']; ?>" SIZE="50"></TD>
</TR>
<TR>
!!!!!!!!!!!! I DELETED LOTZ OF HTML SO THIS WOULD ALL FIT IN POST !!!!!!!!!!!!!!!
<TR>
<TD ALIGN="left" VALIGN="top"><FONT FACE="Arial, Helvetica" SIZE="-1"><B>Which hotel are you staying at?</B></FONT></TD>
<TD ALIGN="left" VALIGN="top"><SELECT NAME="hotel">
<OPTION VALUE="NA">N/A
<OPTION VALUE="Baymont Inn - West Monroe">Baymont Inn - West Monroe
<OPTION VALUE="Best Western - Monroe Airport">Best Western - Monroe Airport
<OPTION VALUE="Best Western - West Monroe">Best Western - West Monroe
<OPTION VALUE="Comfort Inn - Monroe">Comfort Inn - Monroe
<OPTION VALUE="Courtyard by Mariott - Monroe">Courtyard by Mariott - Monroe
<OPTION VALUE="Days Inn - Monroe">Days Inn - Monroe
<OPTION VALUE="Hampton Inn - Monroe">Hampton Inn - Monroe
<OPTION VALUE="Holiday Inn - Holidome - Monroe">Holiday Inn - Holidome - Monroe
<OPTION VALUE="Holiday Inn - Atrium Conference Center - Monroe">Holiday Inn - Atrium Conference Center - Monroe
<OPTION VALUE="Jameson Inn - West Monroe">Jameson Inn - West Monroe
<OPTION VALUE="La Quinta Inn - Monroe">La Quinta Inn - Monroe
<OPTION VALUE="Mariott Fairfield Inn - West Monroe">Mariott Fairfield Inn - West Monroe
<OPTION VALUE="Mariott Residence Inn - Monroe">Mariott Residence Inn - Monroe
<OPTION VALUE="Motel 6 - West Monroe">Motel 6 - West Monroe
<OPTION VALUE="Ramada Limited - Monroe">Ramada Limited - Monroe
<OPTION VALUE="Red Roof - West Monroe">Red Roof - West Monroe
<OPTION VALUE="Shoneys Inn - West Monroe">Shoneys Inn - West Monroe
</SELECT></TD>
</TR></TABLE>
<P>
<FONT FACE="Verdana" SIZE="-1"><B>Registration $40.00 (NON-REFUNDABLE)</B><BR>
<BR>
<FONT FACE="Verdana" SIZE="-1">All information is required in order to process your registration!</FONT></TD>
</TR></TABLE><BR>
<INPUT TYPE="SUBMIT" VALUE="Continue Registration >>"></form></TD>
</TR></TABLE>
</CENTER>
</body>
</html>