I'm working on a page in PHP 5.3.5, and it seems that $_POST doesn't contain the data submitted from my form.
This is the HTML file :
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
And this is the PHP file:
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>
The problem is that the form values are not passed, so I get output like this:
Welcome ! You are years old.
Instead of this:
Welcome John! You are 28 years old.
What am I doing wrong?
Try <?php var_dump($_POST); ?> to see what's really in there. There's no way $_POST is broken - it's gonna be something else. Possibly a server setting could be disabling $_POST.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With