Hello, I am trying to use PHP with HTML to change what is displayed on the page when a link is clicked. Please tell me why this code only displays the content in the first part of the if statement.
Obviously the functions are not being used when the link is clicked - how would i get them to work.
Thanks
<?php
$middle = "index";
function javaForum()
{
$middle = "javaForum";
}
function index()
{
$middle = "index";
}
if($middle == "javaForum")
{
echo "<table border='1'>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>";
}
else if($middle == "index")
{
echo "<p>
<table>
<tr background='Fade2.gif'>
<th>Forum</th>
<th>Threads</th>
<th>Posts</th>
<th>Last post</th>
</tr>
<tr background='Fade3.gif'>
<td colspan='4'>Programming</td>
</tr>
<tr>
<td height='40' width='85'><a style='text-decoration:none' href=''onClick='".javaForum()."'><font color='white'>Java</font></a></td>
<td height='40' width='85'><font color='white'><p align='center'>2</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>3</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>4</p></font></td>
</tr>
<tr>
<td height='40' width='85'><a style='text-decoration:none' href='phpForum.php'><font color='white'>PHP</font></a></td>
<td height='40' width='85'><font color='white'><p align='center'>2</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>3</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>4</p></font></td>
</tr>
<tr background='Fade3.gif'>
<td colspan='4'>General</td>
</tr>
<tr>
<td height='40' width='85'><a style='text-decoration:none' href='ideasForum.php'><font color='white'>Ideas</font></a></td>
<td height='40' width='85'><font color='white'><p align='center'>2</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>3</p></font></td>
<td height='40' width='85'><font color='white'><p align='center'>3</p></font></td>
</tr>
</table>
</p>";
}
?>