Jump to content

Recommended Posts

Hey Guys,

I guess I am missing something here I have tried just about everything I can think of this script is simply showing a blank page no errors nothing ... I even set error reporting to E_ALL and still nothing. can you guys take a look and see if there are any errors here?

<?php
$msg_error = array();
$error = false;
$output_form = true;
/**Checks if the form is submitted and processes only when submit = true**/
if (isset($_POST['submit'])) {

 // Connects to the database
 $dbc = mysqli_connect('host', 'user', 'pass', 'table')
 or die ('Error connecting to MYQSQL server.');


 /**Retrieves the data entered into the registration form
 and stores them in variables**/

 $Change = trim($_POST['Change'];
$MemberID = trim($_POST['MemberID'];
 $FName = trim($_POST['FName']);
 $LName = trim($_POST['LName']);
$Rank = trim($_POST['Rank']);
 $Address = trim($_POST['Address'];
 $City = trim($_POST['City']);
 $State = trim($_POST['State']) ;
 $Zip = trim($_POST['Zip']);
$Email = trim($_POST['Email']);
 $Phone = trim($_POST['Phone']);
 $PhoneType = trim($_POST['PhoneType']);
 $FDepartment = trim($_POST['FDepartment'];
 $FDstate = trim($_POST['FDstate'];
$Terms = trim($_POST['Terms'];
$Status = trim($_POST['Status'];
 $output_form = false;

/**Validates the form to determine for any errors b4 storing to the db**/



 if (empty($Change)) {
	 $msg_error['Change'] = "Are you changing chapters?";
 }
if ($Change == 'Yes' and (empty($MemberID))){
	 $msg_error['MemberID'] = "What is your previous Member ID?";

 if (empty($FName)) {
	 $msg_error['FName'] = "Please enter your first name";
 }

 if (empty($LName)) {
	 $msg_error['LName'] = "Please enter your last name";
 }

 if (empty($Rank)) {
	 $msg_error['Rank'] = "Please enter your Rank ";
 }

 if (empty($Address)) {
	 $msg_error['Address'] = "Please enter your street address";
 }

 if (empty($City)) {
	 $msg_error['City'] = "Please enter your city";
 }

 if (empty($State)) {
	 $msg_error['State'] = "Please select your state";
 }

 if (empty($Zip) || !is_numeric($postcode)) {
	 $msg_error['Zip'] = "Zip code cannot be empty and it must be numbers only.";
 }

 if (empty($phone) || !is_numeric($phone)) {
	 $msg_error['phone'] = "Phone number cannot be empty and it must be numbers only.";
 }

 if (empty($PhoneType)) {
	 $msg_error['PhoneType'] = "Please select your state";
 }

 if (filter_var($Email, FILTER_VALIDATE_EMAIL)) {
}else{
$msg_error['Email'] = "Please enter a valid email";
}

if (empty($FDepartment)) {
	 $msg_error['FDepartment'] = "Please enter your Fire Department's name";
 }

if (empty($FDState)) {
	 $msg_error['FDState'] = "Please Select your Fire Department's state";
 }

if ($Terms == "Disagree") {
	 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
 }elseif ($Terms == ""){
$msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == "Agree"){
$msg_error['Terms'] = "";
}
 if (!empty($msg_error)) {
	 $error = true;
	 $output_form = true;
 }

 /** if there are no errors then it sends to mysql **/
 if (empty($msg_error)) {
	 $create_app = sprintf("INSERT INTO members (Change, MemberID, FName, LName, Rank, Address, City, State, Zip, Email, Phone, PhoneType, FDepartment, FDstate, Terms, Status, app_date) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', CURDATE());",
	 mysqli_real_escape_string($dbc, $Change),
	 mysqli_real_escape_string($dbc, $MemberID),
	 mysqli_real_escape_string($dbc, $FName),
	 mysqli_real_escape_string($dbc, $LName),
	 mysqli_real_escape_string($dbc, $Rank),
	 mysqli_real_escape_string($dbc, $Address),
	 mysqli_real_escape_string($dbc, $City),
	 mysqli_real_escape_string($dbc, $State),
mysqli_real_escape_string($dbc, $Zip),
	 mysqli_real_escape_string($dbc, $Email),
	 mysqli_real_escape_string($dbc, $Phone),
	 mysqli_real_escape_string($dbc, $PhoneType),
	 mysqli_real_escape_string($dbc, $FDepartment),
	 mysqli_real_escape_string($dbc, $FDstate),
mysqli_real_escape_string($dbc, $Terms),
mysqli_real_escape_string($dbc, $Status)
	 );

	 $cu_result = mysqli_query($dbc, $create_app) or trigger_error('Error submitting application please contact the webmaster');

	 msqli_close ($dbc);

	 $output_form = false;
 }
}
 /** if $output_form is true then print the form **/
if($output_form) {
?>
<div id="left8">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="100%" border="0">
 <tr>
 <td colspan="2">Fields Marked with * are required</td>
 </tr>
 <tr>
 <td colspan="2">Today's Date is <?php echo date("m/d/Y"); ?></td>
 </tr>
 <tr>
 <td>Are You Changing Chapters?*</td>
 <td><input type="radio" name="Change" id="chaptchange" value="Yes">
	 Yes
	 <input type="radio" name="Change" id="chaptchange" value="No">
	 No
	 <?php if (isset($msg_error['Change'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Change']);
}?></td>
 </tr>
 <tr>
 <td>Previous Member ID:</td>
 <td><input type="text" name="MemberID" id="MemberID" value="<?php if (!empty($MemberID)) echo $MemberID; ?>">
	 <?php if (isset($msg_error['MemberID'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['MemberID']);
}?></td>
 </tr>
 <tr>
 <td width="15%">*Name:</td>
 <td><input name="FName" type="text" id="FName" placeholder="First Name" value="<?php if (!empty($FName)) echo $FName; ?>" />
	 <input name="LName" type="text" id="LName" placeholder="Last Name" value="<?php if (!empty($LName)) echo $LName; ?>" />
	 <?php if (isset($msg_error['FName'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['FName']);
}?>
	 <?php if (isset($msg_error['LName'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['LName']);
}?></td>
 </tr>
 <tr>
 <td>*Rank/Volunteer:</td>
 <td><input type="text" name="Rank" id="Rank" value="<?php if (!empty($Rank)) echo $Rank; ?>" />
	 <?php if (isset($msg_error['Rank'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Rank']);
}?></td>
 </tr>
 <tr>
 <td>*Street Address:</td>
 <td><input type="text" name="Address" id="Address" value="<?php if (!empty($Address)) echo $Address; ?>" />
	 <?php if (isset($msg_error['Address'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Address']);
}?></td>
 </tr>
 <tr>
 <td>*City:</td>
 <td><input type="text" name="City" id="City" value="<?php if (!empty($City)) echo $City; ?>" />
	 <?php if (isset($msg_error['City'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['City']);
}?></td>
 </tr>
 <tr>
 <td>*State: </td>
 <td><select name="State" id="State" value="<?php if (!empty($State)) echo $State; ?>">
	 <option value="AL">Alabama</option>
	 <option value="AK">Alaska</option>
	 <option value="AZ">Arizona</option>
	 <option value="AR">Arkansas</option>
	 <option value="CA">California</option>
	 <option value="CO">Colorado</option>
	 <option value="CT">Connecticut</option>
	 <option value="DE">Delaware</option>
	 <option value="DC">District of Columbia</option>
	 <option value="FL">Florida</option>
	 <option value="GA">Georgia</option>
	 <option value="HI">Hawaii</option>
	 <option value="ID">Idaho</option>
	 <option value="IL">Illinois</option>
	 <option value="IN">Indiana</option>
	 <option value="IA">Iowa</option>
	 <option value="KS">Kansas</option>
	 <option value="KY">Kentucky</option>
	 <option value="LA" selected="selected">Louisiana</option>
	 <option value="ME">Maine</option>
	 <option value="MD">Maryland</option>
	 <option value="MA">Massachusetts</option>
	 <option value="MI">Michigan</option>
	 <option value="MN">Minnesota</option>
	 <option value="MS">Mississippi</option>
	 <option value="MO">Missouri</option>
	 <option value="MT">Montana</option>
	 <option value="NE">Nebraska</option>
	 <option value="NV">Nevada</option>
	 <option value="NH">New Hampshire</option>
	 <option value="NJ">New Jersey</option>
	 <option value="NM">New Mexico</option>
	 <option value="NY">New York</option>
	 <option value="NC">North Carolina</option>
	 <option value="ND">North Dakota</option>
	 <option value="OH">Ohio</option>
	 <option value="OK">Oklahoma</option>
	 <option value="OR">Oregon</option>
	 <option value="PA">Pennsylvania</option>
	 <option value="RI">Rhode Island</option>
	 <option value="SC">South Carolina</option>
	 <option value="SD">South Dakota</option>
	 <option value="TN">Tennessee</option>
	 <option value="TX">Texas</option>
	 <option value="UT">Utah</option>
	 <option value="VT">Vermont</option>
	 <option value="VA">Virginia</option>
	 <option value="WA">Washington</option>
	 <option value="WV">West Virginia</option>
	 <option value="WI">Wisconsin</option>
	 <option value="WY">Wyoming</option>
	 </select>
	 <?php if (isset($msg_error['State'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['State']);
}?></td>
 </tr>
 <tr>
 <td>*Zip Code: </td>
 <td><input type="text" name="Zip" id="Zip" value="<?php if (!empty($Zip)) echo $Zip; ?>" />
	 <?php if (isset($msg_error['Zip'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Zip']);
}?></td>
 </tr>
 <tr>
 <td>*Email Address:</td>
 <td><input type="text" name="Email" id="Email" value="<?php if (!empty($Email)) echo $Email; ?>" />
	 <?php if (isset($msg_error['Email'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Email']);
}?></td>
 </tr>
 <tr>
 <td>*Phone Number:</td>
 <td><input type="text" name="Phone" id="Phone" value="<?php if (!empty($Phone)) echo $Phone; ?>" />
	 <?php if (isset($msg_error['Phone'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Phone']);
}?></td>
 </tr>
 <tr>
 <td>*Phone Type: </td>
 <td><input type="radio" name="PhoneType" id="PhoneType" value="Cell" />
	 Cell
	 <input type="radio" name="PhoneType" id="PhoneType" value="Home" />
	 Home
	 <input type="radio" name="PhoneType" id="PhoneType" value="Work" />
	 Work
	 <?php if (isset($msg_error['PhoneType'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['PhoneType']);
}?></td>
 </tr>
 <tr>
 <td>*Fire Department/District:</td>
 <td><input name="FDepartment" type="text" id="FDepartment" size="50" placeholder="Do not abbreviate" value="<?php if (!empty($FDepartment)) echo $FDepartment; ?>" />
	 <?php if (isset($msg_error['FDepartment'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['FDepartment']);
}?></td>
 </tr>
 <tr>
 <td> </td>
 <td><font size="2"><em>some text here</em></font></td>
 </tr>
 <tr>
 <td>*Fire Department State:</td>
 <td><p>
	 <select name="FDstate" id="FDstate" value="<?php if (!empty($FDstate)) echo $FDstate; ?>">
		 <option value="AL">Alabama</option>
		 <option value="AK">Alaska</option>
		 <option value="AZ">Arizona</option>
		 <option value="AR">Arkansas</option>
		 <option value="CA">California</option>
		 <option value="CO">Colorado</option>
		 <option value="CT">Connecticut</option>
		 <option value="DE">Delaware</option>
		 <option value="DC">District of Columbia</option>
		 <option value="FL">Florida</option>
		 <option value="GA">Georgia</option>
		 <option value="HI">Hawaii</option>
		 <option value="ID">Idaho</option>
		 <option value="IL">Illinois</option>
		 <option value="IN">Indiana</option>
		 <option value="IA">Iowa</option>
		 <option value="KS">Kansas</option>
		 <option value="KY">Kentucky</option>
		 <option value="LA" selected="selected">Louisiana</option>
		 <option value="ME">Maine</option>
		 <option value="MD">Maryland</option>
		 <option value="MA">Massachusetts</option>
		 <option value="MI">Michigan</option>
		 <option value="MN">Minnesota</option>
		 <option value="MS">Mississippi</option>
		 <option value="MO">Missouri</option>
		 <option value="MT">Montana</option>
		 <option value="NE">Nebraska</option>
		 <option value="NV">Nevada</option>
		 <option value="NH">New Hampshire</option>
		 <option value="NJ">New Jersey</option>
		 <option value="NM">New Mexico</option>
		 <option value="NY">New York</option>
		 <option value="NC">North Carolina</option>
		 <option value="ND">North Dakota</option>
		 <option value="OH">Ohio</option>
		 <option value="OK">Oklahoma</option>
		 <option value="OR">Oregon</option>
		 <option value="PA">Pennsylvania</option>
		 <option value="RI">Rhode Island</option>
		 <option value="SC">South Carolina</option>
		 <option value="SD">South Dakota</option>
		 <option value="TN">Tennessee</option>
		 <option value="TX">Texas</option>
		 <option value="UT">Utah</option>
		 <option value="VT">Vermont</option>
		 <option value="VA">Virginia</option>
		 <option value="WA">Washington</option>
		 <option value="WV">West Virginia</option>
		 <option value="WI">Wisconsin</option>
		 <option value="WY">Wyoming</option>
	 </select>
	 <?php if (isset($msg_error['FDstate'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['FDstate']);
}?>
 </td>
 </tr>
 <tr>
 <td> </td>
 <td> </td>
 </tr>
 <tr>
 <td>*</td>
 <td><p>Terms Statement here <br />
	 <input type="radio" name="Terms" id="Terms" value="Agree" />
	 I Agree
	 <input type="radio" name="Terms" id="Terms" value="Disagree" />
	 I Disagree
	 <?php if (isset($msg_error['Terms'])){
print("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" .$msg_error['Terms']);
}?>
 </td>
 </tr>
 <tr>
 <td> </td>
 <td>*Signature*(Sign using mouse or finger)</td>
 </tr>
 <tr>
 <td> </td>
 <td><?php include("./includes/sigpad.php"); ?></td>
 <tr>
 <td> </td>
 <td>Signature must be valid or application will be returned.</td>
 <tr>
 <td> </td>
 <td><div align="center">
	 <p><font size="3"><strong>Membership Donation $40.00</strong></font> <img src="./images/cart.gif" width="96" height="21" /> <font size="2">Donation statement here</font></p>
	 </div></td>
 <tr>
 <td><input type="hidden" name="Status" value="Review"></td>
 <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
</table>
</form>
</div>
<?php
}
?>

Link to comment
https://forums.phpfreaks.com/topic/270757-form-script-not-running-no-errors/
Share on other sites

How did you enable error reporting; was it done in php.ini, or in the script? If it was done in php.ini, you should be getting errors, because there are at least 7 syntax errors in there.

I did not go through all of the code, but $msg_error is never going to be empty because of this statement:

 

if ($Terms == "Disagree") {
 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == ""){
 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == "Agree"){
 $msg_error['Terms'] = "";
}

 

Since it is not empty, it never writes to the database. Since the contents will, with perfect data, be a single element ("Terms") containing an empty string, there will be no "error" message printed on the form.

I did not go through all of the code, but $msg_error is never going to be empty because of this statement:

 

if ($Terms == "Disagree") {
$msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == ""){
$msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == "Agree"){
$msg_error['Terms'] = "";
}

 

Since it is not empty, it never writes to the database. Since the contents will, with perfect data, be a single element ("Terms") containing an empty string, there will be no "error" message printed on the form.

ok so how do I fix that ? that was the only way that I could think of to write that validation

When you enable error reporting at runtime (in the script), fatal parse errors will not be reported, because the script is killed before any output can be generated by it. Whenever you can, you should enable it in the php.ini file.

That is not the only way to do php validation on any type of form, there are maynt ways in which forms can be validated.

 

For example:

 

$u = mysql_real_escape_string($_POST["username"]);
$p = mysql_real_escape_string($_POST["password"]);

if(empty($u) || empty($p)){      //The empty() functions checks to see if the given $_POST has any type of value in it.
$error_msg  = "The username or password fields are empty";
}else{
//continue validation
}

 

Another:

 

$compare = mysql_query("SELECT username FROM members WHERE username = '$u'");
$check = mysql_fetch_assoc($compare);

if($check["username"] != $u){    //Checks to see if the username the user entered matches any members that have already registered.
$error_msg = "the username provided does not match any registered users";
}

Here Is an updated script with the changes

<?php
$msg_error = array();
$error = false;
$output_form = true;
/**Checks if the form is submitted and processes only when submit = true**/
if (isset($_POST['submit']))
{
// Connects to the database
$dbc = mysqli_connect('host', 'user', 'pass', 'db') or die('Error connecting to MYQSQL server.');
/**Retrieves the data entered into the registration form
and stores them in variables**/
$Change = trim($_POST['Change']);
$MemberID = trim($_POST['MemberID']);
$FName = trim($_POST['FName']);
$LName = trim($_POST['LName']);
$Rank = trim($_POST['Rank']);
$Address = trim($_POST['Address']);
$City = trim($_POST['City']);
$State = trim($_POST['State']);
$Zip = trim($_POST['Zip']);
$Email = trim($_POST['Email']);
$Phone = trim($_POST['Phone']);
$PhoneType = trim($_POST['PhoneType']);
$FDepartment = trim($_POST['FDepartment']);
$FDstate = trim($_POST['FDstate']);
$Terms = trim($_POST['Terms']);
$Status = trim($_POST['Status']);
$output_form = false;
/**Validates the form to determine for any errors b4 storing to the db**/
if (empty($Change))
{
 $msg_error['Change'] = "Are you changing chapters?";
}
if ($Change == 'Yes' and (empty($MemberID)))
{
 $msg_error['MemberID'] = "What is your previous Member ID?";
 if (empty($FName))
 {
  $msg_error['FName'] = "Please enter your first name";
 }
 if (empty($LName))
 {
  $msg_error['LName'] = "Please enter your last name";
 }
 if (empty($Rank))
 {
  $msg_error['Rank'] = "Please enter your Rank ";
 }
 if (empty($Address))
 {
  $msg_error['Address'] = "Please enter your street address";
 }
 if (empty($City))
 {
  $msg_error['City'] = "Please enter your city";
 }
 if (empty($State))
 {
  $msg_error['State'] = "Please select your state";
 }
 if (empty($Zip) || !is_numeric($postcode))
 {
  $msg_error['Zip'] = "Zip code cannot be empty and it must be numbers only.";
 }
 if (empty($phone) || !is_numeric($phone))
 {
  $msg_error['phone'] = "Phone number cannot be empty and it must be numbers only.";
 }
 if (empty($PhoneType))
 {
  $msg_error['PhoneType'] = "Please select your state";
 }
 if (filter_var($Email, FILTER_VALIDATE_EMAIL))
 {
 }
 else
 {
  $msg_error['Email'] = "Please enter a valid email";
 }
 if (empty($FDepartment))
 {
  $msg_error['FDepartment'] = "Please enter your Fire Department's name";
 }
 if (empty($FDState))
 {
  $msg_error['FDState'] = "Please Select your Fire Department's state";
 }
 if ($Terms == "Disagree")
 {
  $msg_error['Terms'] = "You Must agree with the terms to submit the application";
 }
 elseif ($Terms == "")
 {
  $msg_error['Terms'] = "You Must agree with the terms to submit the application";
 }
 elseif ($Terms == "Agree")
 {
  $msg_error['Terms'] = "";
 }
 if (!empty($msg_error))
 {
  $error = true;
  $output_form = true;
 }
 /** if there are no errors then it sends to mysql **/
 if (empty($msg_error))
 {
  $create_app = sprintf("INSERT INTO members (Change, MemberID, FName, LName, Rank, Address, City, State, Zip, Email, Phone, PhoneType, FDepartment, FDstate, Terms, Status, app_date) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', CURDATE());",
																						  mysqli_real_escape_string($dbc, $Change) ,
  mysqli_real_escape_string($dbc, $MemberID) ,
  mysqli_real_escape_string($dbc, $FName) ,
  mysqli_real_escape_string($dbc, $LName) ,
  mysqli_real_escape_string($dbc, $Rank) ,
  mysqli_real_escape_string($dbc, $Address) ,
  mysqli_real_escape_string($dbc, $City) ,
  mysqli_real_escape_string($dbc, $State) ,
  mysqli_real_escape_string($dbc, $Zip) ,
  mysqli_real_escape_string($dbc, $Email) ,
  mysqli_real_escape_string($dbc, $Phone) ,
  mysqli_real_escape_string($dbc, $PhoneType) ,
  mysqli_real_escape_string($dbc, $FDepartment) ,
  mysqli_real_escape_string($dbc, $FDstate) ,
  mysqli_real_escape_string($dbc, $Terms) ,
  mysqli_real_escape_string($dbc, $Status));

  $cu_result = mysqli_query($dbc, $create_app) or trigger_error('Error submitting application please contact the webmaster');
  msqli_close($dbc);
  $output_form = false;
 }
}
/** if $output_form is true then print the form **/
if ($output_form)
{
?>
<div id="left8">
 <form action="<?php
 echo $_SERVER['PHP_SELF']; ?>" method="post">
   <table width="100%" border="0">
  <tr>
    <td colspan="2">Fields Marked with * are required</td>
  </tr>
  <tr>
    <td colspan="2">Today's Date is
	  <?php
 echo date("m/d/Y"); ?></td>
  </tr>
  <tr>
    <td>Are You Changing Chapters?*</td>
    <td><input type="radio" name="Change" id="chaptchange" value="Yes">
	  Yes
	  <input type="radio" name="Change" id="chaptchange" value="No">
	  No
	  <?php
 if (isset($msg_error['Change']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Change']);
 } ?></td>
  </tr>
  <tr>
    <td>Previous Member ID:</td>
    <td><input type="text" name="MemberID" id="MemberID" value="<?php
 if (!empty($MemberID)) echo $MemberID; ?>">
	  <?php
 if (isset($msg_error['MemberID']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['MemberID']);
 } ?></td>
  </tr>
  <tr>
    <td width="15%">*Name:</td>
    <td><input name="FName" type="text" id="FName" placeholder="First Name" value="<?php
 if (!empty($FName)) echo $FName; ?>" />
	  <input name="LName" type="text" id="LName" placeholder="Last Name" value="<?php
 if (!empty($LName)) echo $LName; ?>" />
	  <?php
 if (isset($msg_error['FName']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['FName']);
 } ?>
	  <?php
 if (isset($msg_error['LName']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['LName']);
 } ?></td>
  </tr>
  <tr>
    <td>*Rank/Volunteer:</td>
    <td><input type="text" name="Rank" id="Rank" value="<?php
 if (!empty($Rank)) echo $Rank; ?>" />
	  <?php
 if (isset($msg_error['Rank']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Rank']);
 } ?></td>
  </tr>
  <tr>
    <td>*Street Address:</td>
    <td><input type="text" name="Address" id="Address" value="<?php
 if (!empty($Address)) echo $Address; ?>" />
	  <?php
 if (isset($msg_error['Address']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Address']);
 } ?></td>
  </tr>
  <tr>
    <td>*City:</td>
    <td><input type="text" name="City" id="City" value="<?php
 if (!empty($City)) echo $City; ?>" />
	  <?php
 if (isset($msg_error['City']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['City']);
 } ?></td>
  </tr>
  <tr>
    <td>*State: </td>
    <td><select name="State" id="State" value="<?php
 if (!empty($State)) echo $State; ?>">
	    <option value="AL">Alabama</option>
	    <option value="AK">Alaska</option>
	    <option value="AZ">Arizona</option>
	    <option value="AR">Arkansas</option>
	    <option value="CA">California</option>
	    <option value="CO">Colorado</option>
	    <option value="CT">Connecticut</option>
	    <option value="DE">Delaware</option>
	    <option value="DC">District of Columbia</option>
	    <option value="FL">Florida</option>
	    <option value="GA">Georgia</option>
	    <option value="HI">Hawaii</option>
	    <option value="ID">Idaho</option>
	    <option value="IL">Illinois</option>
	    <option value="IN">Indiana</option>
	    <option value="IA">Iowa</option>
	    <option value="KS">Kansas</option>
	    <option value="KY">Kentucky</option>
	    <option value="LA" selected="selected">Louisiana</option>
	    <option value="ME">Maine</option>
	    <option value="MD">Maryland</option>
	    <option value="MA">Massachusetts</option>
	    <option value="MI">Michigan</option>
	    <option value="MN">Minnesota</option>
	    <option value="MS">Mississippi</option>
	    <option value="MO">Missouri</option>
	    <option value="MT">Montana</option>
	    <option value="NE">Nebraska</option>
	    <option value="NV">Nevada</option>
	    <option value="NH">New Hampshire</option>
	    <option value="NJ">New Jersey</option>
	    <option value="NM">New Mexico</option>
	    <option value="NY">New York</option>
	    <option value="NC">North Carolina</option>
	    <option value="ND">North Dakota</option>
	    <option value="OH">Ohio</option>
	    <option value="OK">Oklahoma</option>
	    <option value="OR">Oregon</option>
	    <option value="PA">Pennsylvania</option>
	    <option value="RI">Rhode Island</option>
	    <option value="SC">South Carolina</option>
	    <option value="SD">South Dakota</option>
	    <option value="TN">Tennessee</option>
	    <option value="TX">Texas</option>
	    <option value="UT">Utah</option>
	    <option value="VT">Vermont</option>
	    <option value="VA">Virginia</option>
	    <option value="WA">Washington</option>
	    <option value="WV">West Virginia</option>
	    <option value="WI">Wisconsin</option>
	    <option value="WY">Wyoming</option>
	  </select>
	  <?php
 if (isset($msg_error['State']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['State']);
 } ?></td>
  </tr>
  <tr>
    <td>*Zip Code: </td>
    <td><input type="text" name="Zip" id="Zip" value="<?php
 if (!empty($Zip)) echo $Zip; ?>" />
	  <?php
 if (isset($msg_error['Zip']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Zip']);
 } ?></td>
  </tr>
  <tr>
    <td>*Email Address:</td>
    <td><input type="text" name="Email" id="Email" value="<?php
 if (!empty($Email)) echo $Email; ?>" />
	  <?php
 if (isset($msg_error['Email']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Email']);
 } ?></td>
  </tr>
  <tr>
    <td>*Phone Number:</td>
    <td><input type="text" name="Phone" id="Phone" value="<?php
 if (!empty($Phone)) echo $Phone; ?>" />
	  <?php
 if (isset($msg_error['Phone']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Phone']);
 } ?></td>
  </tr>
  <tr>
    <td>*Phone Type: </td>
    <td><input type="radio" name="PhoneType" id="PhoneType" value="Cell" />
	  Cell
	  <input type="radio" name="PhoneType" id="PhoneType" value="Home" />
	  Home
	  <input type="radio" name="PhoneType" id="PhoneType" value="Work" />
	  Work
	  <?php
 if (isset($msg_error['PhoneType']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['PhoneType']);
 } ?></td>
  </tr>
  <tr>
    <td>*Fire Department/District:</td>
    <td><input name="FDepartment" type="text" id="FDepartment" size="50" placeholder="Do not abbreviate" value="<?php
 if (!empty($FDepartment)) echo $FDepartment; ?>" />
	  <?php
 if (isset($msg_error['FDepartment']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['FDepartment']);
 } ?></td>
  </tr>
  <tr>
    <td> </td>
    <td><font size="2"><em>List only the Fire Department You Want On Your Membership Card</em></font></td>
  </tr>
  <tr>
    <td>*Fire Department State:</td>
    <td><p>
	    <select name="FDstate" id="FDstate" value="<?php
 if (!empty($FDstate)) echo $FDstate; ?>">
		  <option value="AL">Alabama</option>
		  <option value="AK">Alaska</option>
		  <option value="AZ">Arizona</option>
		  <option value="AR">Arkansas</option>
		  <option value="CA">California</option>
		  <option value="CO">Colorado</option>
		  <option value="CT">Connecticut</option>
		  <option value="DE">Delaware</option>
		  <option value="DC">District of Columbia</option>
		  <option value="FL">Florida</option>
		  <option value="GA">Georgia</option>
		  <option value="HI">Hawaii</option>
		  <option value="ID">Idaho</option>
		  <option value="IL">Illinois</option>
		  <option value="IN">Indiana</option>
		  <option value="IA">Iowa</option>
		  <option value="KS">Kansas</option>
		  <option value="KY">Kentucky</option>
		  <option value="LA" selected="selected">Louisiana</option>
		  <option value="ME">Maine</option>
		  <option value="MD">Maryland</option>
		  <option value="MA">Massachusetts</option>
		  <option value="MI">Michigan</option>
		  <option value="MN">Minnesota</option>
		  <option value="MS">Mississippi</option>
		  <option value="MO">Missouri</option>
		  <option value="MT">Montana</option>
		  <option value="NE">Nebraska</option>
		  <option value="NV">Nevada</option>
		  <option value="NH">New Hampshire</option>
		  <option value="NJ">New Jersey</option>
		  <option value="NM">New Mexico</option>
		  <option value="NY">New York</option>
		  <option value="NC">North Carolina</option>
		  <option value="ND">North Dakota</option>
		  <option value="OH">Ohio</option>
		  <option value="OK">Oklahoma</option>
		  <option value="OR">Oregon</option>
		  <option value="PA">Pennsylvania</option>
		  <option value="RI">Rhode Island</option>
		  <option value="SC">South Carolina</option>
		  <option value="SD">South Dakota</option>
		  <option value="TN">Tennessee</option>
		  <option value="TX">Texas</option>
		  <option value="UT">Utah</option>
		  <option value="VT">Vermont</option>
		  <option value="VA">Virginia</option>
		  <option value="WA">Washington</option>
		  <option value="WV">West Virginia</option>
		  <option value="WI">Wisconsin</option>
		  <option value="WY">Wyoming</option>
	    </select>
	    <?php
 if (isset($msg_error['FDstate']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['FDstate']);
 } ?>
    </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td>*</td>
    <td><p>By signing this application I am attesting that <font style="text-decoration:underline">I am a firefighter</font> / Retired Firefighter
	    I will keep the International and my local chapter aware of any address, phone, e-mail, or Department changes that I may have in the future <br />
	    <input type="radio" name="Terms" id="Terms" value="Agree" />
	    I Agree
	    <input type="radio" name="Terms" id="Terms" value="Disagree" />
	    I Disagree
	    <?php
 if (isset($msg_error['Terms']))
 {
  print ("<br /><font color=\"#99CC00\" style=\"font-size:medium\">" . $msg_error['Terms']);
 } ?>
    </td>
  </tr>
  <tr>
    <td> </td>
    <td>*Signature*(Sign using mouse or finger)</td>
  </tr>
  <tr>
    <td> </td>
    <td><?php
 include ("./includes/sigpad.php");
?></td>
  <tr>
    <td> </td>
    <td>Signature must be valid or application will be returned.</td>
  <tr>
    <td> </td>
    <td><div align="center">
	    <p><font size="3"><strong>Membership Donation $40.00</strong></font> <img src="./images/cart.gif" width="96" height="21" /> <font size="2">$10.00 will be sent to FOOLS International for the International Membership</font> <font size="2">(Make check payable to <font style="text-decoration:underline">Brothers of the Boot</font>)</font></p>
	  </div></td>
  <tr>
    <td><input type="hidden" name="Status" value="Review"></td>
    <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
   </table>
 </form>
</div>
<?php
}
?>

 

ok so how do I fix that ? that was the only way that I could think of to write that validation

 

Leave the last assignment out:

 

if ($Terms == "Disagree") {
 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == ""){
 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
}elseif ($Terms == "Agree"){
}

 

Or better yet, rewrite it:

 

if ($Terms != "Agree") {
 $msg_error['Terms'] = "You Must agree with the terms to submit the application";
}

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.