我写了一段很简单的POST传值问题!为什么我接收页面我用哪种方式接收都是显示得到的值是0.default.html 代码<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户注册登陆</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data" action="actionLogin.php">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="text" name="userpassword"></td>
</tr>
<tr>
<td><input type="submit" value="确定"></td>
<td><input type="button" value="取消"></td>
</tr>
<tr>
<td><a href="#">查看用户</a></td>
<td><a href="#">注册</a></td>
</tr>
</table>
</form>
</body>
</html><?php
$username=$_POST['username'];
$userpassword=$_REQUEST['userpassword'];
echo "aaa";
echo "用户名:"+$username;
echo "密码:"+$userpassword;
if($username!=""&&$userpassword!="")
{
echo $username+"有值";
}
else {
echo "无值";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户注册登陆</title>
</head>
<body>
<form method="POST" enctype="multipart/form-data" action="actionLogin.php">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="text" name="userpassword"></td>
</tr>
<tr>
<td><input type="submit" value="确定"></td>
<td><input type="button" value="取消"></td>
</tr>
<tr>
<td><a href="#">查看用户</a></td>
<td><a href="#">注册</a></td>
</tr>
</table>
</form>
</body>
</html><?php
$username=$_POST['username'];
$userpassword=$_REQUEST['userpassword'];
echo "aaa";
echo "用户名:"+$username;
echo "密码:"+$userpassword;
if($username!=""&&$userpassword!="")
{
echo $username+"有值";
}
else {
echo "无值";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
</body>
</html>
Array ( [username] => aaa [userpassword] => bbb [sbtn] => 确定 [PHPSESSID] => 73cc228dc425e27c57368fa3b1a526f9 )打印出来这个!
echo "username:"+$username+"\r\n";
echo "password:"+$userpassword;总打印出 000 。这是为什么
在ECHO后,可以用逗号,来拼接字串。
echo $userpassword=$_REQUEST['userpassword'];出现的是什么东西?
=============================
echo "用户名:".$username;
echo "密码:".$userpassword;
echo "用户名:".$username;
echo "密码:".$userpassword; echo $username+"有值";改成: echo $username."有值";
echo "密码:"+$userpassword;语法错误, 鉴定完毕, 答案在5楼