<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>在PHP中获取表单数据</title>
</head>
<body>
<from name="from1" method="post" action="7.php">
<table width="405" border="1" cellpadding="1" cellspacing="1">
<tr>
<td width="103" height="25" align="right">用户名:</td>
<td align="left"><input type="text" name="user" size="20"></td>
</tr>
<tr>
<td width="103" height="25" align="right">密码:</td>
<td align="left"><input type="password" name="pwd" id="pwd" size="20"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="submit" id="submit" value="登录">
</td>
</tr>
</table>
</from>
<?php
if($_POST["submit"]=="登录")
{
echo "您输入的用户名为:".$_POST[user];
echo "密码为:".$_POST[pwd];
}
else
{
echo "error";
}
?>
</body>
</html>
------解决思路----------------------
from错了哇
应该是form
------解决思路----------------------
<html>
<head>
<meta charset="utf-8">
<title>在PHP中获取表单数据</title>
</head>
<body>
<form name="from1" method="post" action="4.php">
<table width="405" border="1" cellpadding="1" cellspacing="1">
<tr>
<td width="103" height="25" align="right">用户名:</td>
<td align="left"><input type="text" name="user" size="20"></td>
</tr>
<tr>
<td width="103" height="25" align="right">密码:</td>
<td align="left"><input type="password" name="pwd" id="pwd" size="20"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="submit" id="submit" value="登录">
</td>
</tr>
</table>
</form>
<?php
if($_POST["submit"]=="登录")
{
echo "您输入的用户名为:".$_POST[user];
echo "密码为:".$_POST[pwd];
}
else
{
echo "error";
}
?>
</body>
</html>
更多
0
分享到:
OK了
------解决思路----------------------
<form name="from1" method="post" action="7.php">
</form>
------解决思路----------------------
php有3种获取post值得方式 请都试试
有空能 _post不能解析你的变量 或者是怎么样的