简体   繁体   English

我无法弄清楚在哪里可以关闭表格中的td标签

[英]I can't get figure out where to close off my td tag in table

I have the following code and it does display all the option in the drop down box but I have just noticed that I am missing the </td> somewhere. 我有以下代码,并且确实在下拉框中显示了所有选项,但我刚刚注意到我在某处缺少</td> I tried to place the </td> after my second option tag but for some reason, it doesn't work... Just display all my options outside of table: This is my code: I have tried to place the td tag in all sort of places but not even sure whether I need the td at all here..... 我试图将</td>放置在第二个选项标签之后,但是由于某些原因,它不起作用...仅将所有选项显示在表外:这是我的代码:我试图将td标记放置在各种各样的地方,但甚至不确定我是否在这里需要td .....

<?php
include_once __DIR__.'/header2.php';
if(!$_SESSION['u_uid']) {
  echo "<meta http-equiv='refresh' content='0;url=index.php?create_music_sub=notlogin'>"; 
   exit();
} else {
if($_SESSION['u_permission'] == 0){
    echo "<meta http-equiv='refresh' content='0;url=header2.php?create_music_sub=nopermission'>"; 
    exit();
} else {

    $date = date("Y-m-d H:i:s");


    $sql = "SELECT * FROM music_forum_cats;";

                 $stmt = mysqli_stmt_init($conn);

                if(!mysqli_stmt_prepare($stmt, $sql)) {
                       echo "SQL error";
                    } else {
                 //    mysqli_stmt_bind_param($stmt, "i", $admin);
                      mysqli_stmt_execute($stmt);

                 $result = mysqli_stmt_get_result($stmt);
                      $resultCheck = mysqli_num_rows($result);





                 echo '<form action="create_music_sub_process.php" method="POST">';

                 echo '<table class="create_music_sub">

                      <tr>
                      <th colspan="3" class="update_title">Welcome to the Create Music Sub Category Section '.$_SESSION['u_first'].' '.$_SESSION['u_last'].'</th>
                      </tr>
                      <tr>
                      <th>Category:</th><td>';

                     echo '<select name="create_music_sub"><option disabled selected>Pick a Category</option>';
                while($row = mysqli_fetch_assoc($result)) {

                    $id = $row['id'];


                    echo '<option value="',htmlspecialchars($id),'">',htmlspecialchars($row['category']),'</option></td>';



                     }







                     echo '<tr>
                      <th>Sub Category:</th><td><input type="text" name="sub_cat" placeholder="Create Music Sub Category"></td>
                      </tr>
                      <tr>
                      <th>Creator:</th><td>',htmlspecialchars($_SESSION["u_uid"]),'</td>
                      </tr>
                      <tr>
                      <th>Date Created:</th><td><input type="text" name="date" value="',htmlspecialchars($date),'"></td>
                      </tr>
                      <tr>
                      <th></th><td colspan="2"><input type="submit" name="submit" value="Create Sub Category"></td>
                      </tr>
                       </select></td></tr>
                      </table>
                    </form>';
                        }
                } 

                  }


              include_once __DIR__. '/footer.php';
            ?>

You should remove the " </td> " after each <option> tag, add a closing " </select> " tag after all the <option> tags and add the </td> there. 您应该删除“ </td> ”后每个<option>标签中,添加关闭“ </select> ”标签后,所有的<option>标签,并添加</td>那里。 I think that validating your output could help you. 我认为验证您的输出可以为您提供帮助。 Try using this tool 尝试使用此工具

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

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