I am currently having an issue with having my POST requests display what is required, that is, echo the user input. I am using PhpStorm as my IDE and XAMPP, from the installer for Windows, as my stack.
The user submission form looks as follows, it is a .php file.
<form method="post" action="matches-submit.php">
<fieldset>
<legend>Returning User:</legend>
<ul>
<li><label><strong>Name:</strong></label>
<input id="name" name="name" type="text" size="16">
</li>
<li>
<input id="submit" name="submit" type="submit" value="Sign Up">
</li>
</ul>
</fieldset>
</form>
The form that is supposed to handle this submission is as follows:
<html>
<body>
Welcome
<?php
echo $_POST["name"];
?>
</body>
</html>
However, I am getting an undefined index error. The same issue occurs on my mac where I use the MAMP stack instead. $_GET
works fine, however, per good practice you do not want to use GET when handling forms.
How can I fix it so that it will output "Welcome $UserInputHere"?