I'm reading through a tutorial by devzone.zend.com called PHP 101 and I've been having some problems running a simple script.
I really don't want to move on until I figure out this issue.
Here is the form html:
<html>
<head></head>
<body>
<h2>Today's Special</h2>
<p>
<form method="get" action="cooking.php">
<select name="day">
<option value="1">Monday/Wednesday
<option value="2">Tuesday/Thursday
<option value="3">Friday/Sunday
<option value="4">Saturday
</select>
<input type="submit" value="Send">
</form>
</body>
</html>
Here is the PHP script:
<html>
<head></head>
<body>
<?php
// get form selection
$day = $_GET['day'];
// check value and select appropriate item
if ($day == 1) {
$special = 'Chicken in oyster sauce';
}
elseif ($day == 2) {
$special = 'French onion soup';
}
elseif ($day == 3) {
$special = 'Pork chops with mashed potatoes and green salad';
}
else {
$special = 'Fish and chips';
}
?>
<h2>Today's special is:</h2>
<?php echo $special; ?>
</body>
</html>
I've copied everything exactly and labeled the html file lesson.html and the php script cooking.php
Here is the error message I've been receiving:
Parse error: syntax error, unexpected T_VARIABLE in /home/username/cough_cough/cough/cooking.php on line 10
Line 10 is:
$special = 'Chicken in oyster sauce';
I assume it's not just this line but all the statement lines.
Any help would be great, thanks for the rec. on this website too, it's been extremely helpful.
-Clayton