Jump to content

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();
?>
Link to comment
https://forums.phpfreaks.com/topic/15807-dynamic-list-box/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.