Jump to content

Archived

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

natalieG

Dynamic List Box

Recommended Posts

The select box gets created fine, buit the alert does not function. Really weird, the code
is much like one we use all the time.

Thanks,

Jennifer

<?php
if (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();
?>

Share this post


Link to post
Share on other sites
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]

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.