xxXXMULLIGANXXxx
02-05-2009, 11:53 PM
ok well im on chapter 2 of PHP 6 and MySQL 5 for dynamic websites and I keep getting this error
Parse error: syntax error, unexpected $end
its on line 62 which is the </html> closing
this is what I have for the code
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css" title="text/css" media="all">
.error {
font-weight: bold;
color: #C00
}
</style>
</head>
<body>
<?php
//Validate the name
if (!empty($_REQUEST['name'])) {
$name = $_REQUEST['name'];
} else {
$name = NULL;
echo '<p class="error">You forgot to enter your name!</p>';
}
//Validate email
if (!empty($_REQUEST['email'])) {
$email = $_REQUEST['email'];
} else {
$email = NULL;
echo '<p class="error">You forgot your email address!</p>';
}
//Validate the comments
if (!empty($_REQUEST['comments'])) {
$comments = $_REQUEST['comments'];
} else {
$comments = NULL;
echo '<p class="error">You forgot to add comments</p>';
}
//Validate your gender
if (isset($_REQUEST['gender'])) {
$gender = $_REQUEST['gender'];
if ($gender == 'M') {
echo '<p>Have a good day sir!</p>';
} elseif (gender == 'F') {
echo '<P>Have a good day madam!</p>';
} else { //unacceptable value
$gender = NULL;
echo '<p class="error">You forgot to select a gender</p>';
}
// If everything is ok then print message
if ($name && $email && $gender && $comments) {
echo "<p>Thank you, <b>$name</b>, for the following comments:<br />
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email<i>.</p>\n";
} else { //missing value
echo '<p class="error">Please go back and fill out the form again.</p>';
}
?>
</body>
</html>
Parse error: syntax error, unexpected $end
its on line 62 which is the </html> closing
this is what I have for the code
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css" title="text/css" media="all">
.error {
font-weight: bold;
color: #C00
}
</style>
</head>
<body>
<?php
//Validate the name
if (!empty($_REQUEST['name'])) {
$name = $_REQUEST['name'];
} else {
$name = NULL;
echo '<p class="error">You forgot to enter your name!</p>';
}
//Validate email
if (!empty($_REQUEST['email'])) {
$email = $_REQUEST['email'];
} else {
$email = NULL;
echo '<p class="error">You forgot your email address!</p>';
}
//Validate the comments
if (!empty($_REQUEST['comments'])) {
$comments = $_REQUEST['comments'];
} else {
$comments = NULL;
echo '<p class="error">You forgot to add comments</p>';
}
//Validate your gender
if (isset($_REQUEST['gender'])) {
$gender = $_REQUEST['gender'];
if ($gender == 'M') {
echo '<p>Have a good day sir!</p>';
} elseif (gender == 'F') {
echo '<P>Have a good day madam!</p>';
} else { //unacceptable value
$gender = NULL;
echo '<p class="error">You forgot to select a gender</p>';
}
// If everything is ok then print message
if ($name && $email && $gender && $comments) {
echo "<p>Thank you, <b>$name</b>, for the following comments:<br />
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email<i>.</p>\n";
} else { //missing value
echo '<p class="error">Please go back and fill out the form again.</p>';
}
?>
</body>
</html>
