Excuse my unintelligence, I'm fairly new to php, but I'm working on writing a page for a class and I'm having trouble getting it to work. Taking out all the unnecessary text, here's my code:
<?php
if(!isset($show))
{
$show="";
}
?>
<html><head><title>Lab</title></head>
<body>
<table>
<tr><td>
<h3>Menu</h3>
<ul>
<li><a href="lab.php?show=reagan">Ronald Reagan</a></li>
<li><a href="lab.php?show=kennedy">John F. Kennedy</a></li>
<li><a href="lab.php?show=roosevelt">Franklin Roosevelt</a></li>
<li><a href="lab.php?show=lincoln">Abraham Lincoln</a></li></ul>
</td><td class="content">
<?php
if ("reagan"== $show)
{
echo "<h3 class=\"topHeading\">Ronald Reagan</h3><br />";
echo "<img src=\"reagan.gif\" align=\"left\" /><p>Text1</p>";
}
else if ("kennedy" == $show)
{
echo "<h3 class=\"topHeading\">John F. Kennedy</h3><br />";
echo "<img src=\"kennedy.gif\" align=\"left\" /><p>Text2</p>";
}
else if ("roosevelt" == $show)
{
echo "<h3 class=\"topHeading\">Franklin Roosevelt</h3><br />";
echo "<img src=\"roosevelt.gif\" align=\"left\" /><p>Text3</p>";
}
else if ("lincoln" == $show)
{
echo "<h3 class=\"topHeading\">Abraham Lincoln</h3><br />";
echo "<img src=\"lincoln.gif\" align=\"left\" /><p>Text4</p>";
}
else
{
echo "<center><h1>Presidential Quotes</h1><br /><h3>Text5</h3>
?>
</td></tr>
</table>
</body>
</html>
The way this is supposed to operate is that the page displays "Text5" until one of the links is clicked. The link should assign a value to $show, and then the content cell will display Text1, Text2, Text3, or Text4, depending on which link was clicked. The only problem is, the content cell still shows "Text5," regardless of which links I click. I suspect this is a problem with passing the values via the link, but it could very well be something else that I'm missing. I've gone through this and I can't seem to find the problem. Does anybody see any particualrily noticable errors? Thank you for taking the time to read this.