dropdown menu

From: Date: Fri, 16 Mar 2001 20:11:04 +0000
Subject: dropdown menu
Groups: php.db 
Request: Send a blank email to php-db+get-7550@lists.php.net to get a copy of this message
Okay, maybe this is simple, but I'm at wit's end. I have a drop down menu (code follows) and I want it to show full name (i.e. John Doe) ordered by last name. Works fine under normal circumstances, but then I need it to write the email id associated with the full name to the database. It won't do this. Any ideas??? Code follows. Thanks, Liz ldap table/db: cn= full name, sn= last name, uid= email id orders table/db: req=email id FROM SHOW_LIST.INC, CALLED BY ADD.PHP3 function show_users($users) { $query = "select uid, cn, sn from ldap order by sn ASC"; $db_link = mysql_pconnect('10.10.10.10'); mysql_select_db ('ldap', $db_link); $result = mysql_query ($query); if (($result) && (mysql_num_rows($result) > 0)) {
    while ($line = mysql_fetch_row($result)) {
      $opts[$line[0]] = $line[1];
    }
} else {
    $opts[0] = "Error in show_users()";
} show_select($opts, $users); } FROM ADD.PHP3 function write_to_db() { $temp = explode('-', $GLOBALS["submitted"]); $submitted = $temp[2] . '-' . $temp[0] . '-' . $temp[1]; $temp = explode('-', $GLOBALS["week_of"]); $week_of = $temp[2] . '-' . $temp[0] . '-' . $temp[1]; $ins = "INSERT INTO orders (req, source, number, project, submitted, amount, status, week_of) VALUES ('" . $GLOBALS["req"] . "', '" . $GLOBALS["source"] . "', '" . $GLOBALS["number"] . "', '" . $GLOBALS["project"] . "', '$submitted', '" . $GLOBALS["amount"] . "', '" . $GLOBALS["status"] . "', '$week_of')"; $message = ''; $db_link = mysql_pconnect('10.10.10.10'); mysql_select_db ('Order_Status', $db_link); $audit_message = "Created order number: " . $GLOBALS["source"] . $GLOBALS["number"]; #$audit_sql = "INSERT INTO audittrail (reqnum, date, text) VALUES (" . $GLOBALS["req"] . ", '" . date('Y-m-d H:i:s') . "', '$audit_message')"; if (mysql_query($ins)) {
    $message .= "ADDED " . $GLOBALS["source"] . $GLOBALS["number"] . " . ";
    #mysql_select_db ('op_requests', $db_link);
    #if (mysql_query($audit_sql)) {
    #  $message .= "AUDIT OK.";
    #} else {
    #  $message .= "AUDIT NOT.";
    #}
} else {
    $message .= "ADD NOT. $ins";
} return urlencode($message); }

« previous php.db (#7550) next »