Hi everyone, I am brand new to php and html (started 2 days ago) and I am trying to make a simple program for practice. I did the code and I don't have any errors, but for some reason when I hit submit I don't see a table but instead I see the code.. I am using the 'Coda' application on mac to test it. When I try to use my locahost/chezchase.php to test it, I get error 403, forbidden. Can anyone explain why?
Again, i'm new so sorry if it is something obvious!
here is the code i wrote:
<html>
<head>Daily Menu at Chez Chase</head>
<body>
<?php
if (!isset($_GET['submit'])){
?>
<h1 align= "center"><b>Check out our great meals below!</b></h1>
<form action= "<?php $SERVER_['PHP_SELF'];?>" method= "get">
<select name="day">
<option value="1">Monday/Wednesday</option>
<option value="2">Tuesday/Thursday</option>
<option value="3">Friday/Saturday</option>
<option value="4">Sunday</option>
</select>
<input type="submit" name="submit" value="Check Menu!">
</form>
<?php
}
else {
$day = $_GET['day'];
//use case to determine which menu shows up
switch ($day) {
case 1:
$menu= " ?><table border='1' width= 90% cellspacing= '15' cellpadding= '0'>
<tr>
<td><h4>Breakfast</h4></td>
<td><h4>Lunch</h4></td>
<td><h4>Dinner</h4></td>
</tr>
<tr>
<td>Eggs</td>
<td>Grilled Cheese</td>
<td>Steak</td>
</tr>
<tr>
<td>Bacon</td>
<td>Fries</td>
<td>Mashed Potatoes</td>
</tr>
<tr>
<td>Orange Juice</td>
<td>Chocolate Milk</td>
<td>Wine</td>
</tr>
</table><?php";
break;
case 2:
$menu= "?><table border='1' width= 90% cellspacing= '15' cellpadding= '0'>
<tr>
<td><h4>Breakfast</h4></td>
<td><h4>Lunch</h4></td>
<td><h4>Dinner</h4></td>
</tr>
<tr>
<td>French Toast</td>
<td>Sub</td>
<td>Chicken Parm</td>
</tr>
<tr>
<td>Fresh Fruit</td>
<td>Chips</td>
<td>Penne Pasta</td>
</tr>
<tr>
<td>GrapefruitJuice</td>
<td>Soda</td>
<td>Lemonade</td>
</tr>
</table><?php";
break;
Case 3:
$menu= "?><table border='1' width= 90% cellspacing= '15' cellpadding= '0'>
<tr>
<td><h4>Breakfast</h4></td>
<td><h4>Lunch</h4></td>
<td><h4>Dinner</h4></td>
</tr>
<tr>
<td>muffin</td>
<td>Pizza</td>
<td>Seafood</td>
</tr>
<tr>
<td>Hash Browns</td>
<td>Banana</td>
<td>Bread Rolls</td>
</tr>
<tr>
<td>Milk</td>
<td>Water</td>
<td>Iced Tea</td>
</tr>
</table><?php";
break;
Case 4:
$menu= "Chez Chase is Closed Every Sunday" ;
break;
}
?>
<h2 align=center>Today's Menu Is:</h2><br/>
<?php echo $menu;
}?>
</body>
</html>
Thanks!