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:
[code=php]$queryReq="SELE CT name, description FROM class";
$resultReq = @mysql_query ($queryReq);
echo "<br><form action=index.ph p name='trouble' method='POST'>< select name='class' >";
while($nt=mysql _fetch_array($r esultReq)){echo "<option value=$nt[description]>$nt[name]</option>";}
echo "</select><submit type='button' name='go'/>";
$class = $_POST['class'];
echo "$class</form>";
echo "<br>";[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
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 in javascript within the <select> tag.
It seems like it should be pretty easy to do. Any help would be appreciated.
mrtr33
I have the following code:
[code=php]$queryReq="SELE CT name, description FROM class";
$resultReq = @mysql_query ($queryReq);
echo "<br><form action=index.ph p name='trouble' method='POST'>< select name='class' >";
while($nt=mysql _fetch_array($r esultReq)){echo "<option value=$nt[description]>$nt[name]</option>";}
echo "</select><submit type='button' name='go'/>";
$class = $_POST['class'];
echo "$class</form>";
echo "<br>";[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
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 in javascript within the <select> tag.
It seems like it should be pretty easy to do. Any help would be appreciated.
mrtr33
Comment