Well, I'm a firm believer that one must try to help oneself before expecting anyone else to help, so I've tried to get a little further on my own before posting a follow-up.
I've pretty much figured out that I need to add to the script to pull the value of the options in the drop down menu. I've been able to get the value, but I really don't know what to do with it from there. Once I get the value,I need to compare it with an id# in a resultset and then display the info for that row inside the div, but I'm not sure how to make the connection.
Any help at all is appreciated.
Here's what I have so far:
Code:
<script type="text/javascript">
/*
Combo-Box Viewer script- Created by and © Dynamicdrive.com
Visit http://www.dynamicdrive.com/ for this script and more
This notice MUST stay intact for legal use
*/
if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}
function contractall(){
if (document.getElementById){
var inc=0
while (document.getElementById("dropmsg"+inc)){
document.getElementById("dropmsg"+inc).style.display="none"
inc++
}
}
}
function expandone(){
if (document.getElementById){
var selectedItem=document.dropmsgform.dropmsgoption.selectedIndex
var user_input=document.dropmsgform.dropmsgoption.options[document.dropmsgform.dropmsgoption.selectedIndex].value //add on: get value from options - this works
contractall()
document.getElementById("dropmsg"+selectedItem).style.display="block"
//alert(user_input)
}
}
if (window.addEventListener)
window.addEventListener("load", expandone, false)
else if (window.attachEvent)
window.attachEvent("onload", expandone)
</script>
<form name="dropmsgform">
<select name="dropmsgoption" size="1" onChange="expandone()">
<option selected>-- Choose A League --</option>
<?php
mysql_data_seek($Recordset1, 0);
while ($row_Recordset1 = mysql_fetch_array($Recordset1))
{
?>
<option value="<?php echo $row_Recordset1['num']; ?>"><?php echo $row_Recordset1['name']; ?></option>
<?php } ?>
</select>
</form>
<div id="dropmsg0" class="dropcontent">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<?php do { ?>
<tr>
<td>display data here</td>
</tr>
<?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
</table>
</div>
<?php
for ($i=1; $i <= $totalRows_Recordset1; $i++) {
echo "<div id='dropmsg" . $i . "' class='dropcontent'>";
//$tnum=(This needs to be theoptionvalue from the dropdown);
mysql_select_db($database_connection, $connection);
$query_Recordset3 = "SELECT * FROM standings WHERE num = '$tnum'";
$Recordset3 = mysql_query($query_Recordset3, $connection) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
//do {
display data here
//}
//while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
//echo "Coming Soon";
echo "</div>";
}
?>
Bookmarks