Hi guys,
I have a form which has multiple drop-down menus using the standard <select> tags, but I can only get the results for the first drop-down menu. Does anyone know how I can expand the below code to support multiple variables using a querystring?
Thanks,
Julian
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="zh-HK" />
<title>Timetable</title>
<script type="text/javascript">
function showCourse(string)
{
if (string == "") {
document.getElementById("dynamic_display").innerHTML = "";
return;
}
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("dynamic_display").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "search.php?Subject=" + string, true);
xmlhttp.send();
}
</script>
<style type="text/css">
body {
font-size: 0.75em;
margin: 0px;
padding: 0px;
}
table#search {
border-collapse: collapse;
margin: auto;
width: 956px;
}
table#search tr th {
border: solid #000000 1px;
}
table#results {
border-collapse: collapse;
margin: auto;
width: 956px;
}
table#results tr th {
background-color: #00561c;
border: solid #000000 1px;
color: #ffffff;
}
table#results tr td {
border: solid #000000 1px;
text-align: center;
}
</style>
</head>
<body>
<table id="search">
<form>
<tr>
<th>
<select name="Subject" onchange="showCourse(this.value);">
<option selected="selected" value="">Subject:</option>
<option value="Maths">Maths</option>
<option value="English">English</option>
<option value="Science">Science</option>
</th>
<th>
<select name="Tutor" onchange="showCourse(this.value);">
<option selected="selected">Tutor:</option>
<option value="Tutor%201">Tutor 1</option>
<option value="Tutor%202">Tutor 2</option>
<option value="Tutor%203">Tutor 3</option>
</select>
</th>
<th>
<select name="Level" onchange="showCourse(this.value);">
<option selected="selected">Level:</option>
<option value="Year%201">Year 1</option>
<option value="Year%202">Year 2</option>
<option value="Year%203">Year 3</option>
</select>
</th>
</tr>
</form>
</table>
<div id="dynamic_display"></div>
</body>
</html>