Jump to content


loading select box from php

  • Please log in to reply
1 reply to this topic

#1 natalieG

  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 20 July 2006 - 01:29 PM

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>";



#2 manichean

  • Members
  • PipPip
  • Member
  • 29 posts

Posted 20 July 2006 - 01:39 PM

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.  ;)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users