Jump to content

[SOLVED] Ending Error On My Code!


karatekid36

Recommended Posts

Parse error: syntax error, unexpected $end in /home/carrigan/public_html/php_attend/enter_eboard.php on line 429

 

I have never received this error.  Why is it doing this?  I have looked at this code a few hundred billion times now and I have gone cross eyed.....

 

 
<?php 
if (isset($_POST['submitted'])) {

require_once ('mysql_connect.php');

$errors = array(); // Initialize error array.

// Check for a starting semester.
if (empty($_POST['start_semester'])) {
	$errors[] = 'You forgot to enter a starting semester.';
} else {
	$ss = escape_data($_POST['start_semester']);
}

// Check for an starting year.
if (empty($_POST['start_year'])) {
	$errors[] = 'You forgot to enter a starting year.';
} else {
	$sy = escape_data($_POST['start_year']);
}	

// Check for a ending semester.
if (empty($_POST['end_semester'])) {
	$errors[] = 'You forgot to enter an ending semester.';
} else {
	$es = escape_data($_POST['end_semester']);
}

// Check for an ending year.
if (empty($_POST['end_year'])) {
	$errors[] = 'You forgot to enter an ending year.';
} else {
	$ey = escape_data($_POST['end_year']);
}	

// Check for a master.
if (empty($_POST['master'])) {
	$errors[] = 'You forgot to enter a master.';
} else {
	$ma = escape_data($_POST['master']);
}

// Check for a lt.
if (empty($_POST['lieutenant'])) {
	$errors[] = 'You forgot to enter a lieutenant master.';
} else {
	$lt = escape_data($_POST['lieutenant']);
}

// Check for a exc.
if (empty($_POST['exchequer'])) {
	$errors[] = 'You forgot to enter a exchequer.';
} else {
	$ex = escape_data($_POST['exchequer']);
}

// Check for a brother.
if (empty($_POST['bal'])) {
	$errors[] = 'You forgot to enter a brother at large.';
} else {
	$bl = escape_data($_POST['bal']);
}

// Check for a scribe.
if (empty($_POST['scribe'])) {
	$errors[] = 'You forgot to enter a scribe.';
} else {
	$sc = escape_data($_POST['scribe']);
}

// Check for a Rush chair.
if (empty($_POST['rush'])) {
	$errors[] = 'You forgot to enter a rush chair.';
} else {
	$rc = escape_data($_POST['rush']);
}

// Check for a IFC chair.
if (empty($_POST['ifc'])) {
	$errors[] = 'You forgot to enter an IFC chair.';
} else {
	$ifc = escape_data($_POST['ifc']);
}

// Check for a Risk Manager.
if (empty($_POST['risk'])) {
	$errors[] = 'You forgot to enter Risk Manager.';
} else {
	$rm = escape_data($_POST['risk']);
}

// Check for a House Manager.
if (empty($_POST['house'])) {
	$errors[] = 'You forgot to enter House Manager.';
} else {
	$hm = escape_data($_POST['house']);
}

// Check for a Pledge Manager.
if (empty($_POST['pledge'])) {
	$errors[] = 'You forgot to enter Pledge Master.';
} else {
	$pm = escape_data($_POST['pledge']);
}

// Check for a Sentinel.
if (empty($_POST['sentinel'])) {
	$errors[] = 'You forgot to enter Pledge Master.';
} else {
	$sn = escape_data($_POST['sentinel']);
}	

if (empty($errors)) { // If everything's OK.

	// Register the eboard in the database.

	// Check for previous registration.
	$query = "SELECT eb_id FROM eboard WHERE (start_semester='$ss') AND (start_year='$sy')";
	$result = mysql_query($query);
	if (mysql_num_rows($result) == 0) {

// Make the query.
$query = "INSERT INTO eboard (start_semester, start_year, end_year, end_semester, master, lt, scribe, bal, exchec, rush, pledge, risk, ifc, house, sentinel) VALUES ('$ss', '$sy', '$es', '$ey', '$ma', '$lt', '$sc', '$bl', '$ex', '$rc', '$pm', '$rm', '$ifc', '$hm', '$sn')";

		$result = @mysql_query ($query); // Run the query.
		if ($result) { // If it ran OK.

			// Redirect the user to the thanks.php page.
			// Start defining the URL.
			$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);

			// Check for a trailing slash.
			if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
				$url = substr ($url, 0, -1); // Chop off the slash.
			}

			// Add the page.
			$url .= '/view_eboards.php';

			header("Location: $url");
			exit();

} else { // If it did not run OK.
			$errors[] = 'You could not add the E-Board.'; // Public message.
			$errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message.			

}	

	} else { // E-Board is already Entered.
		$errors[] = 'The E-Board address has already been registered.';


} // End of if (empty($errors)) IF.

 // Close the database connection.
		// Dont Close It Yet!

} else { // Form has not been submitted.

$errors = NULL;

} // End of the main Submit conditional.

// Begin The Page
$page_title = 'Enter a New E-Board';
     include ('includes/header.html');
?>

<h2>Add an Executive Board </h2>
<form action="enter_eboard.php" method="post">

  <p>Starting Semester: 
    <label>
  <input type="radio" name="start_semester" value="Fall" />
Fall</label>
    <label>
  <input type="radio" name="start_semester" value="Spring" />
Spring</label>

    <?php
  // Make the years pull-down menu.
echo '<select name="start_year">';
$year = 2005;
while ($year <= 2020) {
echo "<option value=\"$year\">$year</option>\n";
$year++;
}
echo '</select>';
?>
</p>  
  
  
  <p>Ending  Semester:
    <label>
    <input type="radio" name="end_semester" value="Fall" />
Fall</label>
    <label>
    <input type="radio" name="end_semester" value="Spring" />
Spring</label>
    <?php
  // Make the years pull-down menu.
echo '<select name="end_year">';
$year = 2005;
while ($year <= 2020) {
echo "<option value=\"$year\">$year</option>\n";
$year++;
}
echo '</select>';
?>
</p>

<p><b>Master</b>
  <select name="master"><option>No Brother</option>
  
  <?php

  $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }


?>

</select></p>

<p><b>Lieutenant Master</b>
  <select name="lieutenant" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }


  
?>
  </select></p>
  
  	<p><b>Exchequer</b>
  <select name="exchequer" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }
  
?>
  </select></p>

  	<p><b>Brother-At-Large</b>
  <select name="bal" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }


  
?>
  </select></p>
  
    	<p><b>Scribe</b>
  <select name="scribe" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }  
?>
  </select></p>
  
      	<p><b>Sentinel</b>
  <select name="sentinel" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }  
?>
  </select></p>
  
<p><b>Rush Chair</b>
<select name="rc" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }


  
?>
  </select></p>
  
<p><b>IFC Representative</b>
  <select name="ifc" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }


  
?>
  </select></p>
  
<p><b>Risk Manager</b>
  <select name="rm" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }
  
?>
  </select></p>
  
<p><b>House Manager</b>
<select name="hm" ><option>No Brother</option>
  
  <?php
       $query = "SELECT user_id, CONCAT_WS(' ', first_name, last_name) AS name FROM brothers ORDER BY last_name, first_name ASC";
  if ($result = mysql_query($query)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<option value=\"{$row['user_id']}\">{$row['name']}</option>\n";
      }
    } else {
      echo "No results found";
    }
  } else {
    echo "Query failed<br />$query<br />". mysql_error();
  }
  
?>
  </select></p>
    
<p><input type="submit" name="submit" value="Add E-Board" /></p>
<input type="hidden" name="submitted" value="TRUE" />	
  
</form>	

<?php
include ('./includes/footer.html');
?>

Link to comment
https://forums.phpfreaks.com/topic/51130-solved-ending-error-on-my-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.