在html中选择未显示

时间:2019-06-08 22:44:07

标签: php html sql

因此,我在html中的“选择”没有显示在屏幕上 这是我的代码:

<form class="col s12" action="" method="POST" onsubmit="required()" id="patient_checkout">
  <div class="row">
    <div class="input-field col s12">

      <select name="pid" form="patient_checkout">
        <?php


        $conn = oci_connect("PROJECT", "saadbitar1998", "localhost/XE");
        $query = "SELECT PID,PNAME FROM PATIENT";
        $stid = oci_parse($conn, $query);
        oci_execute($stid);
        while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {




        ?>


        <option value="<?php echo $row['PID'];?>"> <?php echo $row['PNAME']; ?></option>

        <?php
        }
        ?>
      </select>
      <label for="pid">PID: </label>
    </div>
    </div>

其他表单元素显示并正常工作。

1 个答案:

答案 0 :(得分:0)

一个调试问题-以下内容能给您带来预期的结果吗?

<form class="col s12" action="" method="POST" onsubmit="required()" id="patient_checkout">
  <div class="row">
    <div class="input-field col s12">
        <?php
        $conn = oci_connect("PROJECT", "saadbitar1998", "localhost/XE");
        $query = "SELECT PID,PNAME FROM PATIENT";
        $stid = oci_parse($conn, $query);
        oci_execute($stid);
        while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
          echo $row['PID'] . "<br />\n";
          echo $row['PNAME'] . "<br />\n";
        }
        ?>
      <label for="pid">PID: </label>
    </div>
  </div>