当前,我有四个动态更新的选择标记,它们看起来都与下面的代码相同,它们只是从同一mySQL数据库中的不同表中提取的。长解释短。第一个选择标签包括当前注册使用该网站的所有公司。以下三个选择标记包括所有公司的所有注册对象。我希望能够根据第一个标签的选择动态地对最后三个选择标签进行排序,以便他们只看到注册到其公司的对象,而不是所有注册要使用该网站的公司,而无需用户点击提交按钮将选项发布到php脚本进行更新。这可能吗?
<label id="weighCompanylbl" for="weighCompany">Weighing For Company:
</label> <!-- a label that displays indicates that you are going to select
a weigh company -->
<select name="wCompany" onchange="document.getElementById('wTextID').value=this.options[this.selectedIndex].text"> <!-- creates a select tag with onChange update a variable that contains the selected option of the select tag -->
<?php
$query = "SELECT * FROM `weighcompanies`"; //selects the table in which you want to grab information from
$result1 = mysqli_query($conn, $query); //stores that table in a variable
?>
<option value="default">Select A Company...</option> <!-- sets the default value of the select tag -->
<?php while($row1 = mysqli_fetch_array($result1)):;?> <!-- a while loops that populates the select options via the data received from the SQL table above -->
<option value="<?php echo $row1[0];?>"><?php echo $row1[1]; ?></option>
<?php endwhile; ?>
</select>