PHP:
<?
if(!empty($_GET['Category']))
{
$category = $_GET['Category'];
if(!empty($_GET['Poem'])) $poem_id = $_GET['Poem'];
else $poem_id = 1;
$query = "select * from" . $category . "where id='$poem_id' limit 1";
$result = mysql_query($query) or die(mysql_error());
// check to see if this poem actually exists
if(!num = mysql_num_rows($result)) die('Error message when there is no poem with that cat or id');
// if it does
while($row = mysql_fetch_assoc($result))
{
$author = $row['author'];
$email = $row['email'];
$title = $row['title'];
$poem = $row['poem'];
$comment = $row['comment'];
##
##Insert the poem output here
##
}
$next_poem = poem_id + 1;
if($poem_id < 1) $prev_poem = 1;
else $prev_poem = $poem_id - 1;
?>
<a href ="Poem.php?Category=<? echo $category; ?>&Poem=<? echo $prev_poem; ?>">Previous</a>
<a href ="Poem.php?Category=<? echo $category; ?>&Poem=<? echo $next_poem; ?>">Next</a>
<?
}
else
{
##
## Put here what you want to happen if no category is selected.
##
}
Remember I cant test any of this so do some error checking, and do with it what you like.