mrtr33
07-04-2007, 07:48 PM
I have a class table where I want to access the names of courses and the description of each course. The names of the courses go in a drop down list. Based on the user selection, the description shows up as text beneath the drop down menu.
I have the following code:
$queryReq="SELECT name FROM class";
$resultReq = @mysql_query ($queryReq);
echo "<br><form action=index.php name='trouble' method='POST'><select name='class' >";
while($nt=mysql_fetch_array($resultReq)){echo "<option value=$nt[description]>$nt[name]</option>";}
echo "</select><submit type='button' name='go'/>";
$class = $_POST['class'];
echo "$class</form>";
echo "<br>";
How do I use the value of my option tag to display the user's choice in some fashion beneath it? I've mostly seen only static array options handle this problem.
I've tried to retrieve the selection using POST, also tried using an onchange function within the <select> tag.
Any help would be appreciated.
mrtr33
I have the following code:
$queryReq="SELECT name FROM class";
$resultReq = @mysql_query ($queryReq);
echo "<br><form action=index.php name='trouble' method='POST'><select name='class' >";
while($nt=mysql_fetch_array($resultReq)){echo "<option value=$nt[description]>$nt[name]</option>";}
echo "</select><submit type='button' name='go'/>";
$class = $_POST['class'];
echo "$class</form>";
echo "<br>";
How do I use the value of my option tag to display the user's choice in some fashion beneath it? I've mostly seen only static array options handle this problem.
I've tried to retrieve the selection using POST, also tried using an onchange function within the <select> tag.
Any help would be appreciated.
mrtr33