I currently have a drop down with hotel names loaded.
When you select a hotel name the description is suppose to show in the div container but does not… im not sure what is wrong with it. Any ideas?
[COLOR=#000000][COLOR=#0000bb]<?php
[/COLOR][COLOR=#ff8000]// Connect database
[/COLOR][COLOR=#007700]include([/COLOR][COLOR=#dd0000]“includes/connectdb.php”[/COLOR][COLOR=#007700]);
[/COLOR][COLOR=#0000bb]$sql[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]“SELECT hotel_id, hotel_name, hotel_location, hotel_desc FROM hotel ORDER BY hotel_name ASC”[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$result[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]mysql_query[/COLOR]COLOR=#007700;
[/COLOR][COLOR=#0000bb]$options[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]“”[/COLOR][COLOR=#007700];
[/COLOR][COLOR=#0000bb]$id_array [/COLOR][COLOR=#007700]= array();
[/COLOR][COLOR=#0000bb]$hotel_name [/COLOR][COLOR=#007700]= array();
[/COLOR][COLOR=#0000bb]$hotel_location [/COLOR][COLOR=#007700]= array();
[/COLOR][COLOR=#0000bb]$hotel_desc [/COLOR][COLOR=#007700]= array();
while ([/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000bb]mysql_fetch_array[/COLOR]COLOR=#007700) {
[/COLOR][COLOR=#0000bb]$id_array[/COLOR][COLOR=#007700][]=[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_id"[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000bb]$hotel_name[/COLOR][COLOR=#007700][]=[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_name"[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000bb]$hotel_location[/COLOR][COLOR=#007700][]=[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_location"[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000bb]$hotel_desc[/COLOR][COLOR=#007700][]=[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_desc"[/COLOR][COLOR=#007700]];
[/COLOR][COLOR=#0000bb]$options[/COLOR][COLOR=#007700].=[/COLOR][COLOR=#dd0000]"<option VALUE='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_id"[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#dd0000]"'>"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000bb]$row[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]"hotel_location"[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#dd0000]"</option>"[/COLOR][COLOR=#007700];
}
[/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“XHTML namespace”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<title>Untitled Document</title>
</head>
<body>
<!–Example drop down menu 1–>
<form name=“form1”>
<select name=“select1” size=“1” style=“background-color:#FFFFD7” onChange=“displaydesc(document.form1.select1, thetext1, ‘textcontainer1’)”>
[COLOR=#000000][COLOR=#0000bb]<?php [/COLOR][COLOR=#007700]echo [/COLOR][COLOR=#0000bb]$options[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]?>[/COLOR][/COLOR]
</select>
<span id=“textcontainer1” align=“left” style=“font:italic 13px Arial”>
</span>
</form>
<script type=“text/javascript”>
echo “var thetext1 = new Array('”.implode(‘','’,$hotel_desc).“');”;
// Now, see 2) below for final customization step
function displaydesc(which, descriptionarray, container)
{
if (document.getElementById)
document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]
}
</script>
</body>
</html>