Jump to content

Please help with some form validation


RyanMinor

Recommended Posts

I am building a registration page and adding PHP form validation to it. I will be most likely using spry as well, but I want to include PHP form validation. The problem I am having deals with the date of birth and phone number validation. I want the user to enter the date of birth in the format of "yyyy-mm-dd" only and the phone number in the format of "000-000-0000" only. I tested the code below and it tells me that the formats are invalid even when I enter them exactly how I want them. Please help me out. Thanks in advance.

 

<?php session_start(); ?>
<?php require_once('../../Connections/connDB.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Register")) {
$_SESSION['Username'] = $_POST['Email_Address'];

// Initialize array for error messages
$error = array();
// Remove whitespace and check for values
$_POST['Email_Address'] = trim($_POST['Email_Address']);
$_POST['First_Name'] = trim($_POST['First_Name']);
$_POST['Last_Name'] = trim($_POST['Last_Name']);
$_POST['Date_of_Birth'] = trim($_POST['Date_of_Birth']);
$_POST['Phone_Number'] = trim($_POST['Phone_Number']);
$_POST['Travel_Type'] = trim($_POST['Travel_Type']);

// check to see if the user supplied an email address
if (empty($_POST['Email_Address'])) {
$error['Email_Address'] = 'Please enter an email address.';
}
// check to see if the user supplied a first name
if (empty($_POST['First_Name'])) {
$error['First_Name'] = 'Please enter your first name.';
}
// check to see if the user supplied a last name
if (empty($_POST['Last_Name'])) {
$error['Last_Name'] = 'Please enter your last name.';
}
// check to see if the user supplied a date of birth
if (empty($_POST['Date_of_Birth'])) {
$error['Date_of_Birth'] = 'Please enter your date of birth in the format of mm/dd/yyyy.';
}
// check to see if the user supplied a phone number
if (empty($_POST['Phone_Number'])) {
$error['Phone_Number'] = 'Please enter your phone number in the format of 000-000-0000.';
}
// check to see if the user supplied a method of travel
if (empty($_POST['Travel_Type'])) {
$error['Travel_Type'] = 'Please select your desired method of travel.';
}
//check to see if the email address is in the correct format
if (!filter_input(INPUT_POST, 'Email_Address', FILTER_VALIDATE_EMAIL)) {
$error['Email_Invalid'] = 'Your email address is invalid. Please enter a valid email address.';
}
// check to see if the date of birth is in the correct format
if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', 'Date_of_Birth')) {
$error['DOB_Invalid'] = 'Your date of birth is invalid. Please enter a valid date of birth.';
}
// check to see if the phone number is in the correct format
if (!preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/s", 'Phone_Number')) { 
$error['Invalid_Phone'] = 'Your phone number is invalid. Please enter a valid phone number.';  
}
// if no errors, insert the details into the database
if (!$error) {
  $insertSQL = sprintf("INSERT INTO Travel (Email_Address, First_Name, Middle_Name, Last_Name, Date_of_Birth, Phone_Number, Travel_Type, Airport_Depart, Airport_Return, Train_Depart, Train_Return, Inserted) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Email_Address'], "text"),
                       GetSQLValueString($_POST['First_Name'], "text"),
                       GetSQLValueString($_POST['Middle_Name'], "text"),
                       GetSQLValueString($_POST['Last_Name'], "text"),
                       GetSQLValueString($_POST['Date_of_Birth'], "text"),
                       GetSQLValueString($_POST['Phone_Number'], "text"),
                       GetSQLValueString($_POST['Travel_Type'], "text"),
                       GetSQLValueString($_POST['Airport_Depart'], "text"),
                       GetSQLValueString($_POST['Airport_Return'], "text"),
                       GetSQLValueString($_POST['Train_Depart'], "text"),
                       GetSQLValueString($_POST['Train_Return'], "text"),
                       GetSQLValueString($_POST['Inserted'], "date"));

  mysql_select_db($database_connDB, $connDB);
  $Result1 = mysql_query($insertSQL, $connDB);
  if (!$Result1 && mysql_errno() == 1062) {
    $error['Username'] = $_POST['Email_Address'] . ' is already in use.';
  } elseif (mysql_error()) {
    $error['dbError'] = 'Sorry, there was a problem with the database. Please try later.';
  } else {
    $insertGoTo = "travelinfo.php";
    if (isset($_SERVER['QUERY_STRING'])) {
     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
      $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
  }
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TRIO Student Support Services Travel Registration</title>
<link rel=stylesheet type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;
}
.style3 {
font-size: 22pt;
font-weight: bold;
}
.style4 {
font-size: 12pt;
font-weight: bold;
}
.style5 {font-size: 12pt}
</style>
</head>
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" background="../img/background.jpg">

<table height="123" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<!----- insert logo below ------------------------------------------>
<td><img src="../img/blanklogo.jpg" width="574" height="123"></td>
<!------------------------------------------------------------------>
<td width="100%" valign="middle" background="../img/topbg.jpg"><span class="style3">Student Support Services</span><br>
  <span class="style4">Office of Federal TRIO Programs</span></td>
</tr>
</table>

<table height="40" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="100%" background="../img/topbar.jpg"> </td>
</tr>
</table>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">

<td width="201"><BR>
<!----- menu, insert links below ------------------------------------------>
  » <a href="index.php">HOME</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » <a href="reader_resources.php">READER RESOURCES</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » TRAVEL REGISTRATION<BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » <a href="contact_us.php">CONTACT US</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
<!-------------------------------------------------------------------------->
</td>

<td width="100%">
<table width="100%" cellpadding="10" cellspacing="0" border="0">
	<tr valign="top">
		<td>
              <br>
              In order for us to process your travel information, please complete the form below. Once you submit the form an email will be sent to the email address that you provided. Please confirm all information you submitted. Should you need to make any changes you may login to your travel account by clicking here, and make any changes necessary.<br>
              <br>
              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
              <td>
              <fieldset>
              <legend><span class="style5">Travel Registration Form</span></legend>
              <?php
                if (isset($error)) {
		      echo '<div align="center"><span style="color: red">';
		        foreach ($error as $alert) {
		      echo "$alert<br />\n";
		      }
		      echo '</div></span>';
		    }
		  ?>
              <form action="<?php echo $editFormAction; ?>" method="post" name="Register" id="Register">
              <table align="center" cellpadding="5">
              <tr valign="middle">
              <td nowrap align="right">Email Address:</td>
              <td><input type="text" name="Email_Address" value="<?php if (isset($_POST['Email_Address'])) 
		  {echo htmlentities($_POST['Email_Address'], ENT_COMPAT, UTF-;} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">First Name (Exactly as  on photo ID):</td>
              <td><input type="text" name="First_Name" value="<?php if (isset($_POST['First_Name'])) 
		  {echo htmlentities($_POST['First_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Middle Name (Exactly as  on photo ID):</td>
              <td><input type="text" name="Middle_Name" value="<?php if (isset($_POST['Middle_Name'])) 
		  {echo htmlentities($_POST['Middle_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Last Name (Exactly as  on photo ID):</td>
              <td><input type="text" name="Last_Name" value="<?php if (isset($_POST['Last_Name'])) 
		  {echo htmlentities($_POST['Last_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Date of Birth (Enter as YYYY-MM-DD):</td>
              <td><input type="text" name="Date_of_Birth" value="<?php if (isset($_POST['Date_of_Birth'])) 
		  {echo htmlentities($_POST['Date_of_Birth'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Phone Number (Enter as 000-000-0000):</td>
              <td><input type="text" name="Phone_Number" value="<?php if (isset($_POST['Phone_Number'])) 
		  {echo htmlentities($_POST['Phone_Number'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Travel Type:</td>
              <td valign="baseline"><table>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Flying"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Flying" >
              Flying</td>
              </tr>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Driving Myself"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Driving Myself" >
              Driving Myself</td>
              </tr>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Train"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Train" >
              Train</td>
              </tr>
              </table></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Airport Departing From:</td>
              <td><input type="text" name="Airport_Depart" value="<?php if (isset($_POST['Airport_Depart'])) 
		  {echo htmlentities($_POST['Airport_Depart'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Airport Returning To:</td>
              <td><input type="text" name="Airport_Return" value="<?php if (isset($_POST['Airport_Return'])) 
		  {echo htmlentities($_POST['Airport_Return'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Train Station Departing From:</td>
              <td><input type="text" name="Train_Depart" value="<?php if (isset($_POST['Train_Depart'])) 
		  {echo htmlentities($_POST['Train_Depart'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Train Station Returning To:</td>
              <td><input type="text" name="Train_Return" value="<?php if (isset($_POST['Train_Return'])) 
		  {echo htmlentities($_POST['Train_Return'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td colspan="2" align="center" nowrap><input name="Submit" type="submit" id="Submit" value="Submit"> 
              <input type="reset" name="Reset" id="Reset" value="Reset"></td>
              </tr>
              </table>
              <input type="hidden" name="MM_insert" value="Register">
              <input name="Inserted" type="hidden" id="Inserted" value="<?php echo date('Y-m-d H:i:s'); ?>">
              </form>
              </fieldset>
              </td>
              </tr>
              </table>
              <BR>
              <BR>
              <BR>
              <BR>
          </td>
	</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Link to comment
Share on other sites

It looks like you forgot to pass the data of birth field to the preg_match() function.

 

If you change this:

// check to see if the date of birth is in the correct format
if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', 'Date_of_Birth')) {
$error['DOB_Invalid'] = 'Your date of birth is invalid. Please enter a valid date of birth.';
}

 

To this:

if(!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST['Date_of_Birth'])) {
$error['DOB_Invalid'] = 'Your date of birth is invalid. Please enter a valid date of birth.';
}

 

 

It should work. The same thing goes for the code that tests the phone number.

 

 

Also, you should update your error text to match what you're asking for:

// check to see if the user supplied a date of birth
if (empty($_POST['Date_of_Birth'])) {
$error['Date_of_Birth'] = 'Please enter your date of birth in the format of mm/dd/yyyy.';
}

 

The "mm/dd/yyyy" should be changed to "yyyy-mm-dd".

Link to comment
Share on other sites

I'd also add that you do not need two IF statements to validate the same field. There should be an else if so if the first condition fails you do not run the second condition. If you have a validation of birth date to ensure it is not empty, then you do not need to run the validation to check the format.

 

Example:

// check to see if the user supplied a valid date of birth
if (empty($_POST['Date_of_Birth']))
{
    $error['Date_of_Birth'] = 'Please enter your date of birth in the format of yyyy/mm/dd.';
}
else if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST['Date_of_Birth']))
{
    $error['DOB_Invalid'] = 'Your date of birth is invalid. Please enter a valid date of birth in the format of yyyy/mm/dd.';
}

 

By the way, that regular expression will allow ANY four digit year, e.g. 9999 or 0000.

Link to comment
Share on other sites

I read the entire section you gave to me. I am not by my computer with my website files and won't be until after noon. Is this how I would go about validating with strtotime?

 

// check to see if the date of birth is in the correct format
if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/',$_POST['Date_of_Birth'])) {
$error['DOB_Invalid'] = 'Your date of birth is invalid. Please enter a valid date of birth.';
} elseif (!strtotime($_POST['Date_of_Birth'])) {
$error['DOB_Impossible'] = 'Your date of birth is invalid. Please enter a valid date of birth.';
}

Link to comment
Share on other sites

You haven't provided a definition of what you consider to be an "invalid" date. Your regular expression ensures the date is in the "format" you want of yyyy-mm-dd. And, I already provided a means to validate that the "date" can be translated into a valid calendar date using strtotime(). So, what else are you needing?

 

The years 0001 and 9999 ARE valid years. But, based on your application they may not be. If you are asking the user to enter the birthdate of biblical people or when future relatives will be born anything is possible.

 

Personally, I think you are going about this all wrong. Let the user enter anything they want as the date and use strtotome() to validate and use date() to format to your specifications.

Link to comment
Share on other sites

I'm sorry for not clarifying that. Basically your suggestion is what I want to do. I want the user to be able to enter anything in the format of yyyy-mm-dd and have the strtotime validate it based on if its a possible date. I am just getting confused with how to go about using it.

Link to comment
Share on other sites

Hmm...still not working. Here is my new code:

 

<?php session_start(); ?>
<?php require_once('../../Connections/connDB.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Register")) {
$_SESSION['Username'] = $_POST['Email_Address'];

// Initialize array for error messages
$error = array();
// Remove whitespace and check for values
$_POST['Email_Address'] = trim($_POST['Email_Address']);
$_POST['First_Name'] = trim($_POST['First_Name']);
$_POST['Last_Name'] = trim($_POST['Last_Name']);
$_POST['Date_of_Birth'] = trim($_POST['Date_of_Birth']);
$_POST['Phone_Number'] = trim($_POST['Phone_Number']);
$_POST['Travel_Type'] = trim($_POST['Travel_Type']);

// check to see if the user supplied an email address and if the email address is in the correct format
if (empty($_POST['Email_Address'])) 
{
$error['Email_Address'] = 'Please enter your email address.';
} 
elseif (!filter_input(INPUT_POST, 'Email_Address', FILTER_VALIDATE_EMAIL)) 
{
$error['Email_Invalid'] = 'Your email address is invalid.';
}

// check to see if the user supplied a first name
if (empty($_POST['First_Name'])) 
{
$error['First_Name'] = 'Please enter your first name.';
}

// check to see if the user supplied a last name
if (empty($_POST['Last_Name'])) 
{
$error['Last_Name'] = 'Please enter your last name.';
}

// check to see if the user supplied a date of birth, if the date is in the correct format, and if the date is valid
if (empty($_POST['Date_of_Birth'])) 
{
$error['Date_of_Birth'] = 'Please enter your date of birth.';
}
else if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $_POST['Date_of_Birth'])) 
{
$error['DOB_Format'] = 'Please enter your date of birth in the correct format.';
}
elseif (strtotime($_POST['Date_of_Birth']) == -1) 
{
$error['DOB_Invalid'] = 'Your date of birth is invalid.';
}

// check to see if the user supplied a phone number and if the phone number is in the correct format
if (empty($_POST['Phone_Number'])) 
{
$error['Phone_Number'] = 'Please enter your phone number.';
} 
elseif (!preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/s", $_POST['Phone_Number'])) 
{ 
$error['Invalid_Phone'] = 'Please enter your phone number in the correct format.';  
}

// check to see if the user supplied a method of travel 
if (empty($_POST['Travel_Type'])) 
{
$error['Travel_Type'] = 'Please select your desired method of travel.';
}

// if no errors, insert the details into the database
if (!$error) {
  $insertSQL = sprintf("INSERT INTO Travel (Email_Address, First_Name, Middle_Name, Last_Name, Date_of_Birth, Phone_Number, Travel_Type, Airport_Depart, Airport_Return, Train_Depart, Train_Return, Inserted) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Email_Address'], "text"),
                       GetSQLValueString($_POST['First_Name'], "text"),
                       GetSQLValueString($_POST['Middle_Name'], "text"),
                       GetSQLValueString($_POST['Last_Name'], "text"),
                       GetSQLValueString($_POST['Date_of_Birth'], "text"),
                       GetSQLValueString($_POST['Phone_Number'], "text"),
                       GetSQLValueString($_POST['Travel_Type'], "text"),
                       GetSQLValueString($_POST['Airport_Depart'], "text"),
                       GetSQLValueString($_POST['Airport_Return'], "text"),
                       GetSQLValueString($_POST['Train_Depart'], "text"),
                       GetSQLValueString($_POST['Train_Return'], "text"),
                       GetSQLValueString($_POST['Inserted'], "date"));

  mysql_select_db($database_connDB, $connDB);
  $Result1 = mysql_query($insertSQL, $connDB);
  if (!$Result1 && mysql_errno() == 1062) {
    $error['Username'] = $_POST['Email_Address'] . ' is already in use.';
  } elseif (mysql_error()) {
    $error['dbError'] = 'Sorry, there was a problem with the database. Please try later.';
  } else {
    $insertGoTo = "travelinfo.php";
    if (isset($_SERVER['QUERY_STRING'])) {
     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
      $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
  }
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TRIO Student Support Services Travel Registration</title>
<link rel=stylesheet type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;
}
.style3 {
font-size: 22pt;
font-weight: bold;
}
.style4 {
font-size: 12pt;
font-weight: bold;
}
.style6 {color: #FF0000}
.style7 {color: #000000}
</style>
</head>
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" background="../img/background.jpg">

<table height="123" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">

<td><img src="../img/blanklogo.jpg" width="574" height="123"></td>

<td width="100%" valign="middle" background="../img/topbg.jpg"><span class="style3">Student Support Services</span><br>
  <span class="style4">Office of Federal TRIO Programs</span></td>
</tr>
</table>

<table height="40" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="100%" background="../img/topbar.jpg"> </td>
</tr>
</table>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">

<td width="201"><BR>

  » <a href="index.php">HOME</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » <a href="reader_resources.php">READER RESOURCES</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » TRAVEL REGISTRATION<BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
  » <a href="../contact_us.php">CONTACT US</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>

</td>

<td width="100%">
<table width="90%" border="0" align="center" cellpadding="10" cellspacing="0">
    <tr valign="top">
		<td>
              <br>
              In order for us to process your travel information, please complete the form below. Once you submit the form an email will be sent to the email address that you provided. Please confirm all information you submitted. Should you need to make any changes you may login to your travel account by clicking here, and make any changes necessary.<br>
              <br>
              <table width="70%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
              <td>
              <fieldset>
              <legend><span class="style5">Travel Registration Form</span></legend>
              <?php
                if (isset($error)) {
		      echo '<div align="center"><span style="color: red">';
		        foreach ($error as $alert) {
		      echo "$alert<br />\n";
		      }
		      echo '</div></span>';
		    }
		  ?>
              <form action="<?php echo $editFormAction; ?>" method="post" name="Register" id="Register">
              <table align="center" cellpadding="5">
              <tr valign="middle">
              <td nowrap align="right">Email Address <span class="style6">*</span></td>
              <td><input type="text" name="Email_Address" value="<?php if (isset($_POST['Email_Address'])) 
		  {echo htmlentities($_POST['Email_Address'], ENT_COMPAT, UTF-;} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">First Name (Exactly as  on photo ID) <span class="style6">*</span></td>
              <td><input type="text" name="First_Name" value="<?php if (isset($_POST['First_Name'])) 
		  {echo htmlentities($_POST['First_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Middle Name (Exactly as  on photo ID)</td>
              <td><input type="text" name="Middle_Name" value="<?php if (isset($_POST['Middle_Name'])) 
		  {echo htmlentities($_POST['Middle_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Last Name (Exactly as  on photo ID) <span class="style6">*</span></td>
              <td><input type="text" name="Last_Name" value="<?php if (isset($_POST['Last_Name'])) 
		  {echo htmlentities($_POST['Last_Name'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Date of Birth (Enter as YYYY-MM-DD) <span class="style6">*</span></td>
              <td><input type="text" name="Date_of_Birth" value="<?php if (isset($_POST['Date_of_Birth'])) 
		  {echo htmlentities($_POST['Date_of_Birth'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Phone Number (Enter as 000-000-0000) <span class="style6">*</span></td>
              <td><input type="text" name="Phone_Number" value="<?php if (isset($_POST['Phone_Number'])) 
		  {echo htmlentities($_POST['Phone_Number'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="middle">
              <td nowrap align="right">Preferred Method of Travel <span class="style6">*</span></td>
              <td valign="baseline"><table>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Flying"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Flying" >
              Flying</td>
              </tr>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Driving Myself"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Driving Myself" >
              Driving Myself</td>
              </tr>
              <tr>
              <td><input <?php if (!(strcmp($_POST['Travel_Type'],"Train"))) {echo "checked=\"checked\"";} ?> 
              type="radio" name="Travel_Type" value="Train" >
              Train</td>
              </tr>
              </table> </td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Airport Departing From:</td>
              <td><input type="text" name="Airport_Depart" value="<?php if (isset($_POST['Airport_Depart'])) 
		  {echo htmlentities($_POST['Airport_Depart'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Airport Returning To:</td>
              <td><input type="text" name="Airport_Return" value="<?php if (isset($_POST['Airport_Return'])) 
		  {echo htmlentities($_POST['Airport_Return'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Train Station Departing From:</td>
              <td><input type="text" name="Train_Depart" value="<?php if (isset($_POST['Train_Depart'])) 
		  {echo htmlentities($_POST['Train_Depart'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
              <td nowrap align="right">Train Station Returning To:</td>
              <td><input type="text" name="Train_Return" value="<?php if (isset($_POST['Train_Return'])) 
		  {echo htmlentities($_POST['Train_Return'], ENT_COMPAT, 'UTF-8');} ?>" size="32"></td>
              </tr>
              <tr valign="baseline">
                <td colspan="2" align="center" nowrap><span class="style6">*<span class="style7"> denotes a required field</span></span></td>
              </tr>
              <tr valign="baseline">
              <td colspan="2" align="center" nowrap><input name="Submit" type="submit" id="Submit" value="Submit"> 
              <input type="reset" name="Reset" id="Reset" value="Reset"></td>
              </tr>
              </table>
              <input type="hidden" name="MM_insert" value="Register">
              <input name="Inserted" type="hidden" id="Inserted" value="<?php echo date('Y-m-d H:i:s'); ?>">
              </form>
              </fieldset>
              </td>
              </tr>
              </table>
              <BR>
              <BR>
              <BR>
              <BR>
          </td>
	</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
[/ code]

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.