这可能是一个愚蠢的问题,但我想澄清一下如何解决这个问题。我遇到过不少文章,它们允许根据使用 jQuery 和 Ajax 在下拉菜单中所做的选择来设置文本框的值。我的问题是当我尝试根据 5 个下拉菜单中的选择做同样的事情时。我将 Id 值存储在数据库中,该值应用于填充文本框。任何人都可以指导如何通过多个下拉菜单解决这个问题。到目前为止,这是我的代码:
<?php
$sql1="SELECT Schlungen FROM schulung as s";
$result=mysql_query($sql1);
echo "<p align='left'> <strong>Schulung 1</strong> <select name='Schlungen1'> <option value default></option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Schlungen'] . "'>" . $row['Schlungen'] . " </option>";
}
echo "</select>";
?>
<?php
error_reporting(0);
//Drop Down for Schulung 2
$sql2="SELECT Schlungen FROM schulung as s";
$result=mysql_query($sql2);
echo "<p align='left'> <strong>Schulung 2</strong> <select name='Schlungen2'> <option value default></option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Schlungen'] . "'>" . $row['Schlungen'] . " </option>";
}
echo "</select>";
?>
<?php
error_reporting(0);
//Drop Down for Schulung 3
$sql3="SELECT Schlungen FROM schulung as s";
$result=mysql_query($sql3);
echo "<p align='left'> <strong>Schulung 3</strong> <select name='Schlungen3'> <option value default></option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Schlungen'] . "'>" . $row['Schlungen'] . "</option>";
}
echo "</select>";
?>
<?php
error_reporting(0);
//Drop Down for Schulung 4
$sql4="SELECT Schlungen FROM schulung as s";
$result=mysql_query($sql4);
echo "<p align='left'> <strong>Schulung 4</strong> <select name='Schlungen4'><option value default></option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Schlungen'] . "'>" . $row['Schlungen'] . " </option>";
}
echo "</select>";
?>
<?php
error_reporting(0);
//Drop Down for Schulung 5
$sql5="SELECT Schlungen FROM schulung as s";
$result=mysql_query($sql5);
echo "<p align='left'> <strong>Schulung 5</strong> <select name='Schlungen5'><option value default></option>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['Schlungen'] . "'>" . $row['Schlungen'] . " </option>";
}
echo "</select>";
?>
<p align="left"><strong>Access_level </strong>
<input type="text" name="a_level" disabled="disabled">
</p>