Jump to content

Form Posting


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
https://forums.phpfreaks.com/topic/284941-form-posting/
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
https://forums.phpfreaks.com/topic/284941-form-posting/#findComment-1463158
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.