$ _POST不会获得价值

时间:2014-01-28 23:24:27

标签: php

我正在尝试打印页面上的用户名文本框的值,这是我的代码,因为我知道这应该工作。我似乎得到一个名为Use of undefined constant的错误。

<html>

<head></head>
<body>




<form method = "post" action = "index.php">
Username:<input type = "text" name = "username">
<br>
<input type = "Submit" name = "Submit1">



<?php

$username1 = $_POST['username'];

print username1;



?>


</form>

</body>


</html>

2 个答案:

答案 0 :(得分:2)

username1应为$username1

答案 1 :(得分:1)

替换

print username1;

print $username1;