Jump to content


This topic is now archived and is closed to further replies.


loading select box from php

Recommended Posts

we are loading a selct box in ato an html page via AJAX weith this script. The
select 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)){
echo "<option value=\"$PINDEX\">$MYNAME</option>\n";
echo "</select>";



Share this post

Link to post
Share on other sites
Hi natalieG,

I think I found your problem javascript is case sensitive use a small "a" for Alert, you need to chage ur code :
echo "<select name= \"MySelect\" onChange=\"Alert('Hi')\">";
To this:
echo "<select name= \"MySelect\" onChange=\"alert('Hi')\">";

Here is a full example seperate of databse connectivity:
echo "<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";

If you still have troubles give me a shout.  ;)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.