natalieG Posted July 20, 2006 Share Posted July 20, 2006 we are loading a selct box in ato an html page via AJAX weith this script. Theselect box shows up fine, but the alert box does not trigger when we select items. echo "<select name= \"MySelect\" onChange=\"Alert('Hi')\">";while ($LBOXROW=mysql_fetch_array($LBOXFIND,MYSQL_ASSOC)){$MYNAME=$LBOXROW[SPNAME];$PINDEX=$LBOXROW[PINDEX];echo "<option value=\"$PINDEX\">$MYNAME</option>\n";}//whileecho "</select>";Thanks,Jennifer Quote Link to comment https://forums.phpfreaks.com/topic/15140-loading-select-box-from-php/ Share on other sites More sharing options...
manichean Posted July 20, 2006 Share Posted July 20, 2006 Hi natalieG,I think I found your problem javascript is case sensitive use a small "a" for Alert, you need to chage ur code :[quote]echo "<select name= \"MySelect\" onChange=\"Alert('Hi')\">";[/quote]To this:[quote]echo "<select name= \"MySelect\" onChange=\"alert('Hi')\">";[/quote]Here is a full example seperate of databse connectivity:[quote]<html><body><?phpecho "<select name= \"MySelect\" onChange=\"alert('Hi')\">\n";$i =0;while ($i < 5){ $i ++; $MYNAME= "Option".$i; echo "<option value=\"$i\">$MYNAME</option>\n";}echo "</select>\n";?></body></html>[/quote]If you still have troubles give me a shout. ;) Quote Link to comment https://forums.phpfreaks.com/topic/15140-loading-select-box-from-php/#findComment-60992 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.