the problem is this
Code: Select all
Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\phpacademy\visualupload\register.php on line 85Code: Select all
<?php
include("design/header.php");
require("connect.php");
if ($_POST['submit'])
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$username = $_POST['username'];
$password = $_POST['password'];
$password_repeat = $_POST['password_repeat'];
$dob_year = $_POST['dob_year'];
$dob_month = $_POST['dob_month'];
$dob_day = $_POST['dob_day'];
$gender = $_POST['gender'];
if (
$firstname&&
$lastname&&
$username&&
$password&&
$password_repeat&&
$dob_year&&
$dob_month&&
$dob_day&&
$gender)
{
if (strlen($firstname)>25 || strlen($lastname)>25 || strlen($username)>25)
echo "Firstname, lastname and username must be no more than 25 characters.";
else
{
if (strlen($password)>25||strlen($password)<6)
echo "Password must be between 6 and 25 characters.";
else
{
if (is_numeric($dob_year)&&is_numeric($dob_month)&&is_numeric($dob_day)&&$dob_month)
{
if (strlen($dob_year)>4||strlen($dob_month)>2||strlen($dob_day)>2)
echo "Date of birth year must be 4 characters, month and day must be 2.";
else
{
if ($gender=="Male"||$gender="Female")
{
if ($password==$password_repeat)
{
if ($dob_month>12||$dob_day>31)
echo "Date of birth month or day is bigger than expected!";
else
{
$dob_db = "$dob_year-$dob_month-$dob_day";
$password_db = md5($password);
switch ($gender)
{
case "Male":
$gender_db = "M";
break;
case "Female":
$gender_db = "F";
break;
}
$register = mysql_query("INSERT INTO users VALUES ('','$firstname','$lastname','$username','$password_db','$dob_db','$gender_db')");
echo "Success!";
}
else
echo "Passwords do not match!";
}
else
echo "Gender must be Male or Female!";
}
}
else
echo "Date of birth must be in number form. For example, 1989/11/16";
}
}
}
else
echo "Missing field! Please fill in all fields!";
}
else
echo "Please enter your details and click Register.";
?>
<form action='register.php' method='POST'>
<table width='60%'>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>Firstname:
</td>
<td>
<input type='text' value='<?php echo $firstname; ?>' name='firstname' maxlength='25'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>Lastname:
</td>
<td>
<input type='text' value='<?php echo $lastname; ?>' name='lastname' maxlength='25'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>username:
</td>
<td>
<input type='text' value='<?php echo $username; ?>' name='username' maxlength='25'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>password:
</td>
<td>
<input type='password' name='password' maxlength='25'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>Repeat password:
</td>
<td>
<input type='password' name='password_repeat' maxlength='25'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>Date of birth:
</td>
<td>
<input type='text' name='dob_year' maxlength='4' size='3' value='<?php if ($dob_year) echo $dob_year; else echo "YYYY";?>'> / <input type='text' name='dob_month' maxlength='2' size='1' value='<?php if ($dob_month) echo $dob_month; else echo "MM";?>'> / <input type='text' name='dob_day' maxlength='2' size='1' value='<?php if ($dob_day) echo $dob_day; else echo "DD";?>'>
</td>
</tr>
<tr>
<td width='40%' align='right'>
<font size='2' face='arial'>Gender:
</td>
<td>
<select name='gender'>
<option>Male</option>
<option>Female</option>
</select>
</td>
</tr>
</table>
<div align='right'><input type='submit' name='submit' value='register'>
</form>
<?php
include("design/footer.php");
?>

