显示基于php中第一个选择的下拉菜单

时间:2015-12-09 15:04:34

标签: php

我希望根据以前选择的群组名称来显示名称 我硬编码第一个选项,并希望根据前一个选择数据 我仍然困惑如何做到这一点......请指导我

       `<form action="" method="post">
         <table width="39%" height="67" border="0" align="center">
         <tr>
<td width="22%" height="27">Group</td>
<td width="33%"><select name="option"> 
<option>Commerce</option>
<option>Computer</option>
<option>Pre-engineering</option>
<option>Pre-Medical</option>
</select>
</td>

    <td width="8%">Name</td>
<td width="37%"> 
<? if ($option=='Pre-engineering') 
$sql = mysql_query("SELECT name FROM std_reg where faculty='$option'") or die(mysql_error());
while($row = mysql_fetch_array($sql)){
echo "<option>".$row[name]."</option>";}
?>
</td>
<td width="8%">Class</td>
<td width="37%"><input name="class" /></td>

</tr>
<tr>
<td height="34" colspan="4"><strong><h3>
  <input type="submit" name="submit" value="SEARCH" />  
     </h3></strong></td>

</tr>
<br />
<br />

&#39;

1 个答案:

答案 0 :(得分:0)

在此处修复密钥

ASCII