我正在构建一个html表单,需要使用“facility”列值动态填充第一个输入字段 在我的“医生”表中。 设施栏包含我们7个办事处的名称。 但是,当我运行下面的代码时,我的输入字段是空白的,我已经验证了我的“医生”表中有数据。 在此工作之后,我需要能够使用“provider”列值动态填写第二个输入字段(我在下面的代码中没有编码,因为我遇到了第一个输入的问题), 也来自我的“医生”表。 “提供者”列包含我们实践中的所有提供者名称。 但是,应该过滤提供者,以便只显示第一个输入字段中设施的提供者。 p>
<!DOCTYPE html PUBLIC“ - // W3C // DTD HTML 4.01 Transitional // EN”“http://www.w3.org/TR/html4/ loose.dtd“>
< html>
<?php
$ link = mysqli_connect(”localhost“,”USERNAME“,”PASSWORD“);
mysqli_select_db($ link,”DB“); \ n?>
< head>
< title> Untitled Doc< / title>
< meta http-equiv =“content-type”content =“text / html; charset = iso-8859-1”>
< / head>
< body>
< form name“form1”action =“”method =“post”>
< select>
<?php
$ res = mysqli_query($ link,“select facility from doctors”);
while($ row = mysqli_fetch_array($ res)){?>
< option> <?php echo $ row [“facility”]; ?>< / option>
<?php}?>
< / select>
< / form>
< / body>
< / html>
code > pre>
div>