静态页面:

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<form name="form1" id="form1" method="post" action="server.php">
<select name="rootid" id="rootid" onChange="changelocation()"> 
<option value="" selected>- 请选择 -</option> 
<option value="HK Island East">HK Island East</option> 
<option value="2">Yuen Long</option> 
<option value="3">Central and Western</option> 
<option value="4">Kwun Tong</option> 
<option value="5">HK Island South</option> 
<option value="6">Yau Tsim Mong</option> 
<option value="7">Tsuen Wan</option> 
<option value="8">Sham Shui Po</option> 
<option value="9">Wan Chai</option> 
<option value="10">Kowloon City</option> 
<option value="11">Tai Po</option> 
<option value="12">NT North</option> 
<option value="13">Remote Island</option> 
<option value="14">Sai Kung</option> 
<option value="15">Shatin</option> 
<option value="16">Sham Shui Po</option> 
<option value="17">Tseung Kwan O</option> 
<option value="18">Kwai Tsing</option> 
<option value="19">Tuen Mun</option> 
</select>
<script type="text/javascript">
function changelocation(){
    document.getElementById('form1').submit();
}
</script>

提交到程序:

<?php
$conn=mysql_connect('localhost','root','');
mysql_select_db('project');
if (!$conn)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("project",$conn)or die(mysql_error());
 
mysql_query('set names UTF-8');
var_dump($_POST['rootid']);
$result = mysql_query("SELECT * FROM job where rootid='$rootid'");
 
while($row = mysql_fetch_array($result))
{
 
 
echo"<tr>";
echo"<th>" . $row['Job No'] . "</th>";
echo"<th>" . $row['Project Type'] . "</th>";
echo"<th>" . $row['District'] . "</th>";
echo"<th>" . $row['Title'] . "</th>";
echo"<th>" . $row['Google Map label'] . "</th>";
 
echo"</tr>";
}
 
 
 
 /*var_dump($_POST['rootid']);
var_dump($_POST['areaid']);
*/
mysql_close($conn);
?>



本文转载:CSDN博客