I have a very basic form with 4 selections, the selections can be made via radio buttons.
Depending on the selection I want the requested content to show dynamically.
The form code is as follows
<table width="60%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td>
<form name="form1" method="post" action="index.php?page=ptlls1">
<table width="55%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td>All</td>
<td><input name="selection" type="radio" value="all"></td>
</tr>
<tr>
<td>Books</td>
<td><input name="selection" type="radio" value="books"></td>
</tr>
<tr>
<td>Websites & Journals</td>
<td><input name="selection" type="radio" value="sites"></td>
</tr>
<tr>
<td>College</td>
<td><input name="selection" type="radio" value="college"></td>
</tr>
<tr>
<td> </td>
<td><input name="submit1" type="submit" value="Submit"></td>
<td> </td>
<td><?php include 'php/ptllstable.php'; ?></td>
</tr>
</table>
</form></td>
</tr>
</table>
The php code is as follows
<?php
$all_status = 'unchecked';
$book_status = 'unchecked';
$site_status = 'unchecked';
$college_status = 'unchecked';
if (isset($_POST['Submit1']))
{
$selected_radio = $_POST['selection'];
if ($selected_radio == 'book')
{
$book_status = 'checked';
include 'php/ptllsbooks.php';
}
else
if ($selected_radio == 'site')
{
$site_status = 'checked';
include 'php/ptllswebsites.php';
}
else
if ($selected_radio == 'college')
{
$college_status = 'checked';
include 'php/ptllslogin.php';
}
else
if ($selected_radio == 'all')
{
$all_status = 'checked';
include 'php/ptllsresources.php';
}
}
?>
The problem I am having is that the radio button clears and I do not get any dynamic content displaying under the form
I would appreciate some pointers as to where I am going wrong.
Thanks in advance.