hi guys.. im having a prob with a little php and javascript...
im using dreamweaver and i found this 'jumpmenu' thing... ive never used it before and thought it was great....
heres what im trying to use it for:
i have a part of the page where id like to have this jump menu populate with data from mysql (a friendlist to be exact)... whenever the user clicks on any menu item, id like it to reload the same page with a GET at the end of the url of the chosen friends users id.... and i plan to use that id to populate the same page (a different part of the page)...
but when i try to populate it by iterating through my mysql data... it doesnt seem to want to populate... i get the field...but its empty...and i know i have data in in my resultset..cause i populated a different form menu earlier with it (one that isnt javascript enabled )
heres my code
if (mysql_num_rows($result) >= 1)
{
echo 'XXXXXXXXX';
//CREATE MENU FOR ATLEAST ONE FRIEND
$javaselectstring1 = '<select name="fid" size="5" onChange="MM_jumpMenu';
$javaselectstring2 = "('parent',this,0)";
$javaselectstring3 = ">'";
$fulljavaselectstring = $javaselectstring1.$javaselectstring2.$javaselectstring3;
echo $fulljavaselectstring;
//ITERATE THROUGH FRIENDS
while (list ($fid) = mysql_fetch_row ($result))
{
echo '<option value="createmessage.php?fid = '.$fid.'">'.$fid.'</option>';
}
//CLOSE SELECT
echo '</select>';
}
I split the SELECT string into three cause i was having problems with all the quotations and the singlequotes and stuff...so i split it. yeah i know.. im a newbie...
I placed the echo 'XXXXXXX' there for testing purposes... it was echoing the XXXXX...so i know theres data in there to populate the menu with.
im guessing im having this problem cause im mixing javascript with php...and maybe javascript requires all the data to be in the select statement to be static (althought that seems silly like a silly requirement to me) ...or somethin... i dunno... but... id really like for this to work... if its not possible... can you guys guide me to the right direction to get me the same functionality with a different approach?
just to give you guys a better idea... of the javascript invovled... heres what dreamweaver put in the head tag of the document
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>