简体   繁体   English

php代码中的select标签与下一个重叠 <h2> 标记它

[英]select tag inside php code is overlapping the next <h2> tag to it

I tried creating different div tags but still, the select tag inside the PHP code is overlapping it. 我尝试创建不同的div标签,但是PHP代码中的select标签仍然与它重叠。 I have even tried using 我什至尝试使用

<body>
  <header>
    <div class="bgimg">
      <?php include('includes/navbar.php') ?>
      <form onsubmit="" action="changeemployee.php" method="POST">
        <div class="row text-white m-auto">
          <div class="col-lg-4 col-md-4 col-sm-12">
            <h2 class="text-center">Select Username</h2>
            <label>Select Employee's Username</label>
            <?php
              $query = "SELECT empusername FROM empcredential";
              $result = mysqli_query($db, $query);
              echo "<select class='custom-select' name='empusername'>";
              while($row = mysqli_fetch_array($result))
              {
                echo "<option value='".$row['empusername']."'>".$row['empusername']."</option>";
              }
            ?>
          </div>
          <div class="col-lg-4 col-md-4 col-sm-12">
            <!--Corresponding Address-->
            <h2 class="text-center">Corresponding Address</h2>
            <label for="empcoraddress">Address</label>
            <input type="text" class="form-control" id="empcoraddress" name="empcoraddress" required>
            <label for="empcorctv">City/Town/Village</label>
</div>````

I think you forgot to close select tag 我认为您忘了关闭选择标签

<?php
     $query = "SELECT empusername FROM empcredential";
     $result = mysqli_query($db, $query);
     echo "<select class='custom-select' name='empusername'>";
         while($row = mysqli_fetch_array($result))
           {
             echo "<option value='".$row['empusername']."'>".$row['empusername']."</option>";
           }
     echo "</select>";
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM