为什么当我按下提交按钮时我的表单没有被提交?

时间:2021-02-27 16:47:10

标签: php html

所以我的问题只是这个表单没有被提交。当我按下提交按钮或重置按钮时,什么也没有发生。有任何想法吗? (我正在使用 xampp,如果这与它有任何关系,我也是初学者,所以我真的不知道我在做什么)

这是 signUp.php :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf8">
    <title>Sign Up Form</title>
    <link rel="stylesheet" href="../allStyles/formstyles.css?php echo time(); ?>"></head>
<body>
    <table  style="width: 30%;" align=center>
        <form action="/loginSystem/signUpHandler.php" method="post"></form>
            <tr style="background-color: #de8704">
                <td  colspan="2" style="padding-top: 0px; padding-bottom: 0px;"><p style="text-align: left"> Sign Up Form</p></tb>
            </tr>
            
            <tr>
                <td style="text-align:right"><label for="fname">Name
                <td style="text-align:left"><input type="text" id="fname" value="" placeholder="Enter name"></td>
            </tr>
            
            <tr>
                <td style="text-align:right"><label for="lname">Last Name
                <td style="text-align:left"><input type="text" id="lname" value="" placeholder="Enter last name"></td>
            </tr>
            
            <tr>
            <tr>
                <td style="text-align:right">
                <td  style="text-align:left"><input type="radio" name="gender1" id="gender1">Mr
                &nbsp;
                <input type="radio" name="gender2" id="gender2">Mrs
                </td>
            </tr>
            
            <tr>
                <td style="text-align:right">E-mail
                <td  style="text-align:left"><input type="email" id="email" name="email" placeholder="Enter Email"></td>
            </tr>
            
            <tr>
                <td style="text-align:right">Phone Number<td  style="text-align:left"><input type="number" id="pnumber" name="pnumber" placeholder="Enter Phone Number"></td>
            </tr>
            
            <tr>
                <td style="text-align:right"><label for="username">Username
                <td style="text-align:left"><input type="text" id="username" name="username" value=""></td>
            </tr>
            
            <tr>
                <td style="text-align:right">Password<td  style="text-align:left"><input type="password" id="password" name="password" maxlength="8"></td>
            </tr>
            
            <tr>
                <td style="text-align:right;">Confirm <br> Password<td style="text-align:left"><input type="password" id="confpass" name="confpass" maxlength="8"></td>
            </tr>
            
            <tr>
                <td><td><input type="checkbox" value="agree" name="" id="agreed"><label for="agreed">Agree?</label></td>
            </tr>
            
            <tr>
                <td style="background-color: #de8704">
                <td style="text-align: right; background-color: #de8704; padding-top: 4px; padding-bottom: 4px;">
                <input class="send_button" type="submit" value="Send" id="submit" name="submitBtn">
                &nbsp;
                <button class="reset_button" type="reset" id="reset" name="resetBtn">Reset</button></td>
            </tr>   
        </form>
    </table>
</body>
</html> 

signUpHandler.php 是:

<?php

if (!isset($_POST["submitBtn"]))
{
    header("location: ./signUp.php");
}
else
{
    echo "hello";
}

1 个答案:

答案 0 :(得分:1)

<form action="/loginSystem/signUpHandler.php" method="post"></form>

您在预期之前关闭了表单标签,请将您的按钮放在表单标签内,也许它会起作用:D

相关问题