Dan F
Dan F

Reputation: 27

POST not working for HTML Form

I'm working on a registration page using an html form, however when I use post it doesn't submit the data. All this code is in the index.php file, so it directs to itself for the form action.

<form action="index.php" method="post" style="align-content: left;text-align: center;padding:10px" id="signForm">
            Company: <input type="text" value="" name="company"><br>
            Email: <input style="margin-top:5px" type="text" value="" name="email"><br>
            Username: <input style="margin-top:5px" type="text" value="" name="username"><br>
            Password: <input style="margin-top:5px" type="password" value="" name="password"><br>
            Verify Password: <input style="margin-top:5px" type="password" value="" name="password2"><br>
            <input style="margin-top:10px" type="submit" value="Submit" name="submitr">
        </form>

And here is the php, which is located above the form on the page.

if(isset($_POST['submitr'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password2 = $_POST['password2'];
    $email = $_POST['email'];
    $company = $_POST['company'];
    ...
}

I've tried outputting the variables, however they are always blank, and I cannot seem to figure out why. Any help would be greatly appreciated! Thank you!

Upvotes: 0

Views: 5200

Answers (1)

Norman
Norman

Reputation: 79

Try add a name to the form , also try add the enctype attribute in the form What does enctype='multipart/form-data' mean?

Upvotes: 1

Related Questions