Any assistance would be greatly appreciated.
Code: Select all
<?php
function showForm($errorEmail=false,$errorFirstName=false,$errorLastName=false,$errorMoBirth=false,$errorDoBirth=false,$errorYoBirth=false,$errorSecQuest=false,$errorSecAns=false){
echo "<p align='center'>Account Creation</p>";
echo "<form action='index.php' method='POST'>";
echo "
<table width='500px' border='0' cellspacing='5' cellpadding='0' align='center'>
<tr>
<td valign='top' align='right'>
First Name:
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<input type='text' name='firstName' length='15' size='15'>";
if ($errorFirstName) echo "<br><font size='2' color='red'>Please enter a First Name.</font>";
echo "
</td>
</tr>
<tr>
<td valign='top' align='right'>
Last Name:
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<input type='text' name='lastName' length='15' size='15'>";
if ($errorLastName) echo "<br><font size='2' color='red'>Please enter a Last Name.</font>";
echo "
</td>
</tr>
<tr>
<td valign='top' align='right'>
Email Address:
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<input type='text' name='emailAdd' length='32' size='32'>";
if ($errorEmail) echo "<br><font size='2' color='red'>Please enter a valid Email.</font>";
echo "
</td>
</tr>
<tr>
<td valign='top' align='right'>
Date of Birth:<br>
<font size='2'>(mm/dd/yyyy)</font>
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<select name='MoBirth'>
<option value='01' selected='selected'>January</option>
<option value='02'>February</option>
<option value='03'>March</option>
<option value='04'>April</option>
<option value='05'>May</option>
<option value='06'>June</option>
<option value='07'>July</option>
<option value='08'>August</option>
<option value='09'>September</option>
<option value='10'>October</option>
<option value='11'>November</option>
<option value='12'>December</option>
</select>
<input type='text' length='2' size='2' name='DoBirth' value='01'>
<input type='text length='4' size='4' name='YoBirth' value='2004'>";
if ($errorMoBirth || $errorDoBirth || $errorYoBirth) echo "<br><font size='2' color='red'>Please enter a valid Date of Birth.</font>";
echo "
</td>
</tr>
<tr>
<td valign='top' align='right'>
Security Question:
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<select name'secQuest'>
<option value='1'>
What is your primary frequent flyer number
</option>
<option value='2'>
What is your library card number
</option>
<option value='3'>
What was your first phone number
</option>
<option value='4'>
What was your first teacher's name
</option>
<option value='5'>
What is your mother's maiden name
</option>
<option value='6'>
What is your father's middle name
</option>
</select>";
if ($errorSecQuest) echo "<br><font size='2' color='red'>Please enter a valid question.</font>";
echo "
</td>
</tr>
<tr>
<td valign='top' align='right'>
Answer:<br>
<font size='2'>(32 characters max.)</font>
</td>
<td width='10px'></td>
<td valign='top' align='left'>
<input type='text' name='secAns' length='32' size='32'>";
if ($errorSecAns) echo "<br><font size='2' color='red'>Please enter an answer.</font>";
echo "
</td>
</tr>
<tr>
<td colspan='3' valign='top' align='center'>
<input type='submit' value='Create Account'>
</td>
</tr>
</table>
</form>";
}
if (!isset($_POST['SubmitForm'])) {
showForm();
} else {
//Init error variables
$errorEmail = false;
$errorFirstName = false;
$errorLastName = false;
$errorMoBirth = false;
$errorDoBirth = false;
$errorYoBirth = false;
$errorSecQuest = false;
$errorSecAns = false;
$firstName = isset($_POST['firstName']) ? trim($_POST['firstName']) : '';
$lastName = isset($_POST['lastName']) ? trim($_POST['lastName']) : '';
$emailAdd = isset($_POST['emailAdd']) ? trim($_POST['emailAdd']) : '';
$MoBirth = isset($_POST['MoBirth']) ? trim($_POST['MoBirth']) : '';
$DoBirth = isset($_POST['DoBirth']) ? trim($_POST['DoBirth']) : '';
$YoBirth = isset($_POST['YoBirth']) ? trim($_POST['YoBirth']) : '';
$secQuest = isset($_POST['secQuest']) ? trim($_POST['secQuest']) : '';
$secAns = isset($_POST['secAns']) ? trim($_POST['secAns']) : '';
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $emailAdd)) $errorEmail = true;
if (strlen($firstName)<1 || strlen($firstName)>32) $errorFirstName = true;
if (strlen($lastName)<1 || strlen($lastName)>32) $errorLastName = true;
if (strlen($MoBirth)<2 || strlen($MoBirth)>2) $errorMoBirth = true;
if (strlen($DoBirth)<2 || strlen($DoBirth)>2) $errorDoBirth = true;
if (strlen($YoBirth)<2 || strlen($YoBirth)>2) $errorYoBirth = true;
if (strlen($secQuest)<1 || strlen($secQuest)>6) $errorSecQuest = true;
if (strlen($secAns)<1 || strlen($secAns)>32) $errorSecAns = true;
if ($errorEmail || $errorFirstName || $errorLastName || $errorMoBirth || $errorDoBirth || $errorYoBirth || $errorSecQuest || $errorSecAns) {
showForm($errorEmail,$errorFirstName,$errorLastName,$errorMoBirth,$errorDoBirth,$errorYoBirth,$errorSecQuest,$errorSecAns);
} else {
echo "Submission was success!";
}
}
?>
oh.. how embarrassing...
Code: Select all
<input type='submit' name='SubmitForm' value='Create Account'>Code: Select all
<input type='submit' value='Create Account'>