So_Cute
08-06-2007, 09:01 PM
1) Script Title: Combo-Box Viewer
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/comboviewer.htm
3) Describe problem: I'm using this script to create a select menu that is populated from a MySQL database with corresponding data to be displayed inside the div.
I can get the select menu populated easy enough. The problem comes in getting the option value to use it to create a recordset for the additional data. The original DD script does not specify a value for the <option> so I'm wondering if something else needs to be added to the script to store the option value.
Here's what I have so far:
<form name="dropmsgform">
<select name="dropmsgoption" size="1" onChange="expandone()">
<option selected>-- Choose A League --</option>
<?php while ($row_Recordset1 = mysql_fetch_array($Recordset1))
{
?>
<option value="<?php echo $row_Recordset1['name']; ?>"><?php echo $row_Recordset1['name']; ?></option>
<?php } ?>
</select>
</form>
<?php
for ($i=1; $i <= $totalRows_Recordset1; $i++) {
echo "<div id='dropmsg" . $i . "' class='dropcontent'>";
echo $row_Recordset1['name'];
echo "</div>";
}
?>
The select menu works; the incrementation of the dropmsg #'s work. The only thing that doesn't work is the display of the league name inside the div. I think it must because there is nothing in the original script to handle the value of the option from the select menu.
Am I right? Is what I'm trying to do even possible?
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/comboviewer.htm
3) Describe problem: I'm using this script to create a select menu that is populated from a MySQL database with corresponding data to be displayed inside the div.
I can get the select menu populated easy enough. The problem comes in getting the option value to use it to create a recordset for the additional data. The original DD script does not specify a value for the <option> so I'm wondering if something else needs to be added to the script to store the option value.
Here's what I have so far:
<form name="dropmsgform">
<select name="dropmsgoption" size="1" onChange="expandone()">
<option selected>-- Choose A League --</option>
<?php while ($row_Recordset1 = mysql_fetch_array($Recordset1))
{
?>
<option value="<?php echo $row_Recordset1['name']; ?>"><?php echo $row_Recordset1['name']; ?></option>
<?php } ?>
</select>
</form>
<?php
for ($i=1; $i <= $totalRows_Recordset1; $i++) {
echo "<div id='dropmsg" . $i . "' class='dropcontent'>";
echo $row_Recordset1['name'];
echo "</div>";
}
?>
The select menu works; the incrementation of the dropmsg #'s work. The only thing that doesn't work is the display of the league name inside the div. I think it must because there is nothing in the original script to handle the value of the option from the select menu.
Am I right? Is what I'm trying to do even possible?