I assume you mean you want to have a user fill out an HTML form that has a class_id field, which is used to pull the whole row from a DB about that class.
Assuming you have a table in your database that has three fields.
1 = the class id, or unique class identifier
2 = the description of the class
3 = the teacher
Create your form and have it point to itself
<form action="<?=$PHP_SELF; ?>" method="post">
<input type=text name="class_id">
<input type=submit value="yes">
<form>
<?
// check to see if the form was submitted
if ($submit == "yes") {
// connect to DB
$connection = mysql_connect($hostname,$mysql_username,$mysql_password);
mysql_select_db($database, $connection);
// create SQL query
$query_result = "(select * from $table where class_id = '$class_id'");
// extract the row of data that matches the class_id variable from the form
$row = mysql_fetch_row ($query_result);
}
// print the table with the values inside it
echo "<TABLE><TR><TD>";
echo $row[0];
echo "</TD><TD>";
echo $row[1];
echo "</TD><TD>";
echo $row[2];
echo "</TD></TR></TABLE>";
?>
Obviously you will want to do some input validation and you may have to use different syntax depending on your PHP settings, but this is a rough idea of what you are describing, I think.