我在这里有一个PHP代码,并想知道如何显示你在框中写的内容:我做了这个,它确实显示了这一个:"$ input"; ?>"
<html>
<head></head>
<body>
<form action="message.php" method="post">
Enter your message: <input type="text" name="msg" size="30">
<input type="submit" value="Send">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
===============这是我的message.php
<html>
<head></head>
<body>
<?php
// retrieve form data
$input = $_POST['msg'];
// use it
echo "You said: <i>$input</i>";
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
=======
这是我作为查看页面源获得的:
<html>
<head></head>
<body>
<?php
// retrieve form data
$input = $_POST['msg'];
// use it
echo "You said: <i>$input</i>";
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这很奇怪actually.Check曾经在您的网页浏览器中键入只本地主机,然后运行你用正确的途径了页面就说明你的HTML页面,然后再为$ _REQUEST到位POST.Just对你message.php补充一点: -
<?php
print "<pre>";print_r($_POST);print "</pre>";
print "<pre>";print_r($_REQUEST);print "</pre>";
?>
Run Code Online (Sandbox Code Playgroud)
检查一下此后得到的输出...您可以轻松调试这样的事情.
| 归档时间: |
|
| 查看次数: |
96 次 |
| 最近记录: |