<html>
<head><title>会员登录系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="white"text="black"link="blue"vlink="purple"alink="red">
<h1 align="center">会员登录系统</h1>
<form action=chk.php method=post name="form2">
<p align="center">请输入帐号:<input type="text" name="user_id"></p>
<p align="center">请输入密码:<input type="password" name="user_password"></p>
<p align="center"><input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重设"></p>
</form>
</body>
</html>
以上这段代码获取的数据怎么无法传递到以下这段代码?我用的是appwerv2.5.8是不是这个版本有问题还是method=post有问题啊。直接就显示下一段代码,而不显示“会员登录成功”或“会员登录失败”。
<?
$link=mysql_connect('localhost','root','830720');
mysql_query("use db1");
$result=mysql_query("select * from user where id='".$_POST['user_id']."'and password='".$_POST['user_password']."'",$link);
if(mysql_num_rows($result)==1)
{
echo "<center>会员登录成功</center>";
}
else
{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);
mysql_close($link);
?>
<head><title>会员登录系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="white"text="black"link="blue"vlink="purple"alink="red">
<h1 align="center">会员登录系统</h1>
<form action=chk.php method=post name="form2">
<p align="center">请输入帐号:<input type="text" name="user_id"></p>
<p align="center">请输入密码:<input type="password" name="user_password"></p>
<p align="center"><input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重设"></p>
</form>
</body>
</html>
以上这段代码获取的数据怎么无法传递到以下这段代码?我用的是appwerv2.5.8是不是这个版本有问题还是method=post有问题啊。直接就显示下一段代码,而不显示“会员登录成功”或“会员登录失败”。
<?
$link=mysql_connect('localhost','root','830720');
mysql_query("use db1");
$result=mysql_query("select * from user where id='".$_POST['user_id']."'and password='".$_POST['user_password']."'",$link);
if(mysql_num_rows($result)==1)
{
echo "<center>会员登录成功</center>";
}
else
{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);
mysql_close($link);
?>
楼主【ljctnt】截止到2008-07-01 21:53:35的历史汇总数据(不包括此帖):
发帖的总数量:5 发帖的总分数:100
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:5 未结的总分数:100
结贴的百分比:0.00 % 结分的百分比:0.00 %
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
mysql_query("use db1");
$result=mysql_query("select * from user where id='".$_POST['user_id']."'and password='".$_POST['user_password']."'",$link); 其中有一个错误.估计..还有你上面的语句是写在HTML上面还是下面?
不是<?