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?