php problem
Hey there, im running this code and getting this error.
Parse error: parse error, unexpected $end in C:\Program Files\Apache Group\Apache2\htdocs\handle_form.php on line 62
im running off localhost and ive set register_globals to on, someone please help if you can. thanks
handle_form.php
PHP:
<html>
<head>
<title>Simple Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// check name and strip slashes
if (strlen($name) > 0) {
$name = stripslashes($name);
} else {
$name = NULL;
echo "You forgot to enter your name!</br><p>";
}
// Check Comments and strip slashes
if (strlen($comments) > 0) {
$comments = stripslashes($comments);
} else { // if there are no comments
$comments = NULL;
echo "You forgot to add some comments!</br><p>";
// Check Email and strip slashes
if (!(strlen($email) > 0)) {
$email = stripslashes($email);
} else { // didnt add email address
$email = NULL;
echo "You Forgot to add your email!</br><p>";
// Check Gender...
if (isset($gender)) {
if ($gender == 'M') {
$message = '<b><p>Good day, Sir!</b><p>';
} elseif ($gender == 'F') {
$message = '<b><p>Good day, Madam!</b></p>';
}
} else { // if no gender was selected...
$gender = NULL;
echo "You forgot to select your Gender!</br></p>";
}
// If everything was filled out, print the message.
if ($name && $comments && $email && $gender){
echo "thankyou <b>$name</b> for the following comment(s):
<br /><tt>$comments</tt><p>
We Will reply back to you at <i>$email</i> soon.</p>";
echo $message;
}
?>
</body>
</html> (<--- this is line 62)
form.html
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<form action="handle_form.php" method="post">
<fieldset><Legend>Enter your information in the form below:</Legend>
<p><b>Name:</b> <input type="text" name="name" size="20" maxlength="40" /></p>
<p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="60" /></p>
<p><b>Gender:</b> <input type="radio" name="gender" Value="M" /> Male
<input type="radio" name="gender" Value="F" /> Female</p>
<p><b>Age:</b> <select name="age">
<option value="0-30">Under 30</option>
<option value="30-60">Between 30 and 60</option>
<option value="60+">Over 60</option>
</select></p>
<p><b>Comment:</b> <textarea name="comments" rows="3" cols="50"></textarea></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Submit Information" /></div>
</form></body>
</html>


