我想要从PHP变量“list_cust_name”中选定的项目,通过在该WHERE子句中传递该PHP变量,通过该SQL查询在另一个下拉列表“list_cust_city”中获取值。这里是我的代码..请帮助我..如何获得所选的下拉项目在php变量
<td width="228">
<label style="color:#000">Name </label>
<?php
$query_name = "SELECT DISTINCT cust_name FROM customer_db ORDER BY cust_name"; //Write a query
$data_name = mysql_query($query_name); //Execute the query
?>
<select id="list_cust_name" name="list_cust_name">
<?php
while($fetch_options_name = mysql_fetch_assoc($data_name)) { //Loop all the options retrieved from the query
?>
<option value="<?php echo $fetch_options_name['cust_name']; ?>"><?php echo $fetch_options_name['cust_name']; ?></option>
<?php
}
?>
</select>
</td>
<td width="250">
<label style="color:#000">City </label>
<?php
$query_city = "SELECT DISTINCT cust_city FROM customer_db ORDER BY cust_city"; //Write a query
$data_city = mysql_query($query_city); //Execute the query
?>
<select id="list_cust_city" name="list_cust_city">
<?php
while($fetch_options_city = mysql_fetch_assoc($data_city)) { //Loop all the options retrieved from the query
?>
<option value="<?php echo $fetch_options_city['cust_city']; ?>"><?php echo $fetch_options_city['cust_city']; ?></option>
<?php
}
?>
</select>
</td>
这里你需要ajax。 – Jokey
无法得到您的实际问题... –
你想在这里刷新页面?或者@Jokey建议你在这里需要ajax来达到这个效果 –