ok here is some code... this is the code i tried for the switch function
<?php
if(!isset($_GET['id'])) {
$_GET['id'] = NULL;
}
?>
<div class="center">
<a href="book.php?book=title">title</a>
<a href="book.php?book=All"></a>
</div>
<div class="left">
<?php
switch (@$_GET['book'])
{
case "All":
$result = mysql_query("SELECT * FROM simple_search");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{echo "<ul><li><a href=\"?id={$row['stitle']}\">";
echo $row['stitle'];
echo "</a></li></ul>";}
break;
case "title":
$result = mysql_query("SELECT * FROM simple_search WHERE type='title'");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{echo "<ul><li><a href=\"?id={$row['stitle']}\">";
echo $row['stitle'];
echo "</a></li></ul>";}
break;
}
?>
</div>
<div class="right">
<?php
$id = $_GET['id'];
$result = $database->query("SELECT * FROM simple_search WHERE stitle='$id'") or die ("cant do it");
while ($rows = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "
<table border\"1\" width=\"100%\">
<tr>
<td width=\"20%\" valign=\"top\">{$rows['stitle']}</td>
<td width=\"20%\" valign=\"top\">{$rows['sdescription']}</td>
<td width=\"20%\" valign=\"top\">{$rows['type']}</td>
<td width=\"40%\" valign=\"top\">{$rows['sbody']}</td>
<tr>
</table>";
}?>
and here is the code i tried for the form action function
<div class="middle">
<form method="get" action="book.php">
<input type="submit" name="book" value="All" />
<input type="submit" name="book" value="title" />
</form>
</div>
<div class="left">
<?php
if(isset($_GET['book'])){
$action = $_GET['book'];
} else {
$action = 'All';
}
if(!isset($_GET['id'])) {
$_GET['id'] = NULL;
}
$result = mysql_query("SELECT * FROM simple_search");
while ($row2 = mysql_fetch_array($result, MYSQL_ASSOC))
if($action == 'All') {
echo "<ul>";
echo "<li>";
echo "<a href=\"?id={$row2['stitle']}\">";
echo $row2['stitle'];
echo "</a>";
echo "</li>";
echo "</ul>";
}
$result = mysql_query("SELECT * FROM simple_search WHERE type='title'");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
if($action == 'title') {
echo "<ul>";
echo "<li>";
echo "<a href=\"?id={$row['stitle']}\">";
echo $row['stitle'];
echo "</a>";
echo "</li>";
echo "</ul>";
}
?>
</div>
<div class="right">
<?php
$id = $_GET['id'];
$result = $database->query("SELECT * FROM simple_search WHERE stitle='$id'") or die ("cant do it");
while ($rows = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<table border\"1\" width=\"100%\">
<tr>
<td width=\"20%\" valign=\"top\">{$rows['stitle']}</td>
<td width=\"20%\" valign=\"top\">{$rows['sdescription']}</td>
<td width=\"20%\" valign=\"top\">{$rows['type']}</td>
<td width=\"40%\" valign=\"top\">{$rows['sbody']}</td>
<tr>
</table>";
}?>
both sets of code work the same way links in div1 (middle) display dynamic links in div2 from mysql field (left) display mysql row in div3 (right).
sorry for not adding the code to my first post.
P0PZ