i get the following error:
PHP Parse error: syntax error, unexpected end of file on line 59
Here is my code:
<?php
require_once("FormFunctions.php");
require_once("ValidationFunction.php");
$errors = array();
$message = "";
if (isset($_POST['submit'])){ // form was submitted
$username = trim($_POST["username"]);
$password = trim($_POST["password"]);
// validations
$fields_required = array("username", "password");
foreach($fields_required as $field){
$value = trim($_POST[$field]);
if (!has_presence($value)){
$errors[$field] = ucfirst($field) . " cannot be blank";
}
}
$field_max_length = array("username" => 10, "password" => 5);
foreach($fields_max_length as $field => $max){
$value = trim($_POST[$field]);
if (!max_length($value, $max)){
$errors[$field] = ucfirst($field) . " is too long";
if (empty($errors)){
// try to log in
if ($username == "CIS108" && $password == "PHP"){ // login successful
redirect_to("process1.php");
} else{ // login failed
$message = "Login failed! Username and password combination was incorrect.<br/>Please log in again.";
}
}
} else{
$message = "please log in.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Two</title>
</head>
<body>
<h1>Third form login</h1>
<b><?php echo $message;?></b>
<b><?php echo form_errors($errors);?></b>
<form action="Form3.php" method="post">
First Name: <input type="text" name="first_name" value="" /><br />
Last Name: <input type="text" name="last_name" value="" /><br />
Username: <input type="text" name="username" value="" /><br />
Password: <input type="password" name="password" value="" /><br /><br />
<input type="submit" name="submit" value="Submit Form" />
</body>
</html>
I don't understand why I am getting this error. I have sifted through this code over and over but can't seem to see what is wrong. I am pretty new at writing code, so it would surprise me if its something simple, but i just don't see it.