第二个提交按钮不显示

Second submit button not showing

我创建了一个表单,其方法为“POST”,操作为“#”,表示将数据发送到同一页面。 现在提交表格后, 下面出现第二个表单,它从数据库中获取数据(根据第一个表单上的选择)并为用户提供编辑记录的控件。

一切正常 唯一的问题是“*第二个表单提交按钮没有显示”

我在该特定页面的代码:(editcategory.php)

<?php
    require_once("admin_panel.php");
?>
<!DOCTYPE html>
<head>
    <title>Users</title>
    <link rel="stylesheet" href="css/footer.css">
    <style>
        .bodystart{
            margin-top:2%;
            margin-left:25%;
        }
        h1{
            font-size:xx-large;
        }
        table {
            border-collapse: separate;
            border-spacing:5px 5px;
            width: auto;
            color: #588c7e;
            font-family:"Lucida Console", "Courier New", monospace;
            font-size: 20px;
            text-align: left;
        }
        th {
            background-color: #588c7e;
            color: white;
        }
        option:nth-child(even) {
            background-color: #f2f2f2
        }
        .submitnewcat{
            margin-top:3%;
            color:#ffffff;
            padding:5px;
            border-radius:10 px;
            background-color:#4CAF50;
            cursor:pointer;
        }
        form{
            margin-top:5%;
        }
        input,select{
            border-style:inset;
            border-left:6px solid green;
            background-color:#ced6e0;
            padding: 12px 15px;
            border-radius:5px;
        }
        .catidcont{
            background-color:#c7ecee;
            cursor:default;
        }
        label{
            padding:12px 15px;
            font-size:larger;
            background-color:#130f40;
            color:#ffffff;
            border-radius:5px;
            border:2px solid red;
        }
    </style>
</head>
<body>
    <div class="bodystart">        
        <h1><i>Edit Category</i></h1>

        <form method="POST" action="#">
            <label>Select Category</label>
            <?php
                $sql = "SELECT * FROM category";
                $result = mysqli_query($db_conn,$sql);
                echo "<select name='catset' required>";
                echo "<option value=''>Select</option>";
                while ($row = $result->fetch_assoc()) {
                    echo "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
                }
                echo "</select>";
            ?>
            <button class="submitnewcat" name="submit3" type="submit" value="Submit">Fetch Details</button>
        </form>
        <?php
            if(isset($_POST["submit3"])==true){
                function validate($data){
                $data = trim($data);
                $data = stripslashes($data);
                $data = htmlspecialchars($data);
                return $data;
                }
                $x=(int)$_POST['catset'];
                $sql = "SELECT * FROM category a WHERE a.id=$x";
                $result = $db_conn->query($sql);
                if ($result->num_rows > 0) {
                    $row = $result->fetch_assoc();
                    echo "<form method='POST' action='updatecategory.php'";
                        echo "<input type='hidden' readonly>";
                        echo "<label>Category ID</label>";
                        echo "<input type='number' name='catid' value=$x readonly style='cursor:no-drop;'><br><br><br>";
                        echo "<label>New Category Name</label>";
                        echo "<input type='text' name='newcatname' required placeholder='".$row['name']."'>";
                        echo "<label>Status</label>";
                        echo "<select name='newstat' required>";
                        if($row["status"]==1){
                            $catstat="Active";
                            
                            echo "<option value='".$row['status']."' selected>$catstat</option>";
                            echo "<option value='2'>Disabled</option>";
                        }
                        else{
                            $catstat="Disabled";
                            echo "<option value='1'>Active</option>";
                            echo "<option value='".$row['status']."' selected>$catstat</option>";
                        }
                        echo "<button class='submigtnewcat' name='submit4' type='submit' value='Submit'>Fetch Details</button>";
                    echo "</form>";
                }
                        
            } ?>
    </div>
</body>
<?php
require_once("include/footer.php");?>
</html>

我页面的片段

有错误你没有关闭 select 的标签所以按钮没有显示。

希望你已经得到答案。

                  echo "<select name='newstat' required>";
                    if($row["status"]==1){
                        $catstat="Active";
                        
                        echo "<option value='".$row['status']."' selected>$catstat</option>";
                        echo "<option value='2'>Disabled</option>";
                    }
                    else{
                        $catstat="Disabled";
                        echo "<option value='1'>Active</option>";
                        echo "<option value='".$row['status']."' selected>$catstat</option>";
                    }
                   echo "</select>";