Jump to content

Form Posting


Dustin45309
Go to solution Solved by Dustin45309,

Recommended Posts

I've been trying to work on a form in PHP. I've got it all set up and submitting but the only problem is that I try to display the data back on the page for testing purposes but every time I hit submit, it empties the form with no results. I've written my code as follows:

<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="styling.css">
</head>
<body>
<form action="registerplayer.php" action="POST">
<p>First Name:<input type='text' name='firstName'></p>
<p>Last Name:<input type='text' name='lastName'></p>
<p>Username:<input type='text' name='username'></p>
<p>Password:<input type='text' name='password'></p>
<p><input type='submit' value='Submit'></p>
</form>
<?php
if(isset($_POST["firttName"]) && isset($_POST["lastName"]) && isset($_POST["username"]) && isset($_POST["password"]))
{
$firstname = $_POST["firstName"];
$lastname = $_POST["lastName"];
$username = $_POST["username"];
$password = $_POST["password"];
echo "<p>Name: " . $firstname . " " . $lastname . "\nUsername: " . $username . "\nPassword: " . $password . "</p>";

}
?>
</body></html>

Anyone know what I'm not seeing here? I've been working on this for a while now.

Link to comment
Share on other sites

(isset($_POST["firttName"]) 

has a typo tt instead of st

 

Thanks for the catch but it's not echoing my test results. For some reason, my form says

<form method="POST">

But I looked at my URL and it shows this:

 

http://localhost/registerplayer.php?firstName=dustin&lastName=koeller&username=dak45309&password=aa

 

This is on my computer but for some reason, it's acting like a get. I did fix that catch though but it still doesn't work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.