Here's a basic way to do that. There's a lot left out here (database connection, error checking, the $id variable is assumed to be set in this script, etc), but you should get the idea.
$query = mysql_query("SELECT catname FROM poems WHERE catid='".$id."'") or die(mysql_error());
$row = mysql_fetch_assoc($query);
echo "This is a collection of poems on " . $row["catname"] . "<br />\n";