我正在使用PHP 5.3.5中的页面,它似乎$_POST不包含从我的表单提交的数据.
这是HTML文件:
<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>
Run Code Online (Sandbox Code Playgroud)
这是PHP文件:
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
问题是表单值没有传递,所以我得到这样的输出:
Welcome ! You are years old.
而不是这个:
Welcome John! You are 28 years old.
我究竟做错了什么?
php ×1