Dustin45309 Posted December 28, 2013 Share Posted December 28, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/284941-form-posting/ Share on other sites More sharing options...
davidannis Posted December 28, 2013 Share Posted December 28, 2013 (isset($_POST["firttName"]) has a typo tt instead of st Quote Link to comment https://forums.phpfreaks.com/topic/284941-form-posting/#findComment-1463157 Share on other sites More sharing options...
Dustin45309 Posted December 28, 2013 Author Share Posted December 28, 2013 (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. Quote Link to comment https://forums.phpfreaks.com/topic/284941-form-posting/#findComment-1463158 Share on other sites More sharing options...
Solution Dustin45309 Posted December 28, 2013 Author Solution Share Posted December 28, 2013 I found that my form had <form action=" " action="post"> which should've been <form action=" " method="post"> Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/284941-form-posting/#findComment-1463159 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.