Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_POST in php 5.3.5 does not work

Tags:

php

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?

like image 647
naji Avatar asked Mar 13 '26 14:03

naji


1 Answers

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.

like image 60
Nick Locking Avatar answered Mar 16 '26 04:03

Nick Locking



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!