选择1st时,将第1个下拉框值传递给第2个下拉框

时间:2016-04-21 15:27:18

标签: php mysql ajax

当我从数据库表中选择Aitem' table1'时,如何将所选元素传递到另一个下拉框?哪个id是1然后第二个下拉框显示table2有Aitem ID的项目?

<tr>
<td>Markė</td>

<td><?php
include_once('inc\connect.php');
$sql = "SELECT * FROM marke";
$result = mysql_query($sql);

echo "<select name='marke' id='a5'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['marke'] ."'>" . $row['marke'] ."</option>";
}
echo "</select>";
?></td>
</tr> 

<tr>
<td>Modelis</td>
<td><?php
include_once('inc\connect.php');
$sql = "SELECT * FROM modelis WHERE marke_id = $marke";
$result = mysql_query($sql);

echo "<select name='modelis' id='a6'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['modelis'] ."'>" . $row   ['modelis'] ."</option>";
}
echo "</select>";
?></td></td>

0 个答案:

没有答案