natalieG Posted July 27, 2006 Share Posted July 27, 2006 The select box gets created fine, buit the alert does not function. Really weird, the codeis much like one we use all the time.Thanks,Jennifer<?phpif (isset($_REQUEST['INDEXA']) and (strlen($_REQUEST['INDEXA'])>0)){$MYINDEX=$_REQUEST['INDEXA'];} else {echo 'NO INDEXA'; exit;}define('DB_HOST','localhost');define('DB_USER','msdsimg');define('DB_PASSWORD','misner01');define('DB_NAME','msdsimg');$conn=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die ('Did Not Connect');mysql_select_db(DB_NAME) or die ('Cannot Set Database');$CONTACTQUERY="SELECT CONTACTNAME,CLIENTINDEX,INDEXA FROM PIMCONTACTS WHERE CLIENTINDEX=$MYINDEX ORDER BY CONTACTNAME";$CONTACTFIND=mysql_query($CONTACTQUERY) or die ('CONTACT QUERY ' . mysql_error());$CONTACTCOUNT=mysql_num_rows($CONTACTFIND);if($CONTACTCOUNT >=5){$SIZE=5;} else {$SIZE=1;}$RESULTSTR="<SELECT ID=\"CONTID\" NAME=\"CONTSEL\" SIZE=\"$SIZE\">";$RESULTSTR .= "<OPTION VALUE=\"0\">Select CONTACT</OPTION>";while ($CONTACTROW=mysql_fetch_array($CONTACTFIND,MYSQL_ASSOC)){$CONTACTINDEX=$CONTACTROW[INDEXA];$CONTACTNAME=$CONTACTROW[CONTACTNAME];$RESULTSTR .= "<OPTION VALUE=\"$CONTACTINDEX\" onChange=\"alert('Hi')\">$CONTACTNAME</OPTION>";}//while$RESULTSTR .="</SELECT>";echo $RESULTSTR;mysql_close();?> Link to comment https://forums.phpfreaks.com/topic/15807-dynamic-list-box/ Share on other sites More sharing options...
wildteen88 Posted July 27, 2006 Share Posted July 27, 2006 onChange=\"alert('Hi')\" is in the wrong place, it shoud be in the select tag:[code]<SELECT ID=\"CONTID\" NAME=\"CONTSEL\" SIZE=\"$SIZE\" onChange=\"alert('Hi')\">[/code] Link to comment https://forums.phpfreaks.com/topic/15807-dynamic-list-box/#findComment-64668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.