this is almost working when i select an email it shows the name field but it shows more than one name on select as the php echo array returns more than 1 value how can i get it working to show the correct name only? The problem seems to be in defining the “names” in the <script> area!
<?PHP
include(“../checkadminlogin.php”);
include(“../../global/connection.php”);
$sql = “select intNameID, email,fname, lname, place from tbladvisorsdetails where place=’A’ order by intNameID ASC”;
$temps01=$DB_site->query($sql);
while ($row=$DB_site->fetch_array($temps01))
{
$selected = ($nameid==$row[“intNameID”]) ? ‘ selected=”selected”‘ : ”;
$email_options .= ” <option value=”{$row[‘intNameID’]}”$selected>{$row[’email’]}</option>n”;
$js_names_array .= “names[{$row[‘intNameID’]}] = ‘{$row[‘fname’]} {$row[‘lname’]}’;n”;
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “
<html xmlns=”
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>APA</title>
<link rel=”stylesheet” type=”text/css” href=”office.css” />
<script type=”text/javascript”>
var names = new Array();
<?php echo $js_names_array; ?>
function changeName(value) {
document.getElementById(‘USEDname’).value = (names);
}
</script>
</head>
<body>