html post 实现注册哦那功能 表单数据传递失败 代码如下
网页一<html><formmethod="POST"action="zhuce2.php"><p>用户名:<inputtype="text"name="username...
网页一
<html>
<form method="POST" action="zhuce2.php">
<p>用 户 名:
<input type="text" name="username">
</p>
<p>登录密码:
<input type="password" name="password">
</p>
<p>重复密码:
<input type="password" name="passwordb">
</p>
<p>保 密 码:
<input type="password" name="key">
</p>
<p>
<input type="submit" value="提交">
<input type="reset" value="重置">
</p>
</form>
</html>
网页二
<?php
$con=mysql_connect("localhost","root","");
$sqlname="users_db";
mysql_select_db($sqlname,$con);
$username=$_POST['username'];
$password=$_POST['password'];
$passwordb=$_POST['passwordb'];
$key=$_POST['key'];
if($password==$passwordb)
{
$con = mysql_connect("localhost","root","");
$sql="insert into users(username,password,key)
values
('$_POST[username]','$_POST[password]','$_POST[key]')";
echo "<script>alert('注册成功');</script>";
}
else
{
echo "<script>alert('两次密码输入不一致');history.back();</script>";
}
?> 展开
<html>
<form method="POST" action="zhuce2.php">
<p>用 户 名:
<input type="text" name="username">
</p>
<p>登录密码:
<input type="password" name="password">
</p>
<p>重复密码:
<input type="password" name="passwordb">
</p>
<p>保 密 码:
<input type="password" name="key">
</p>
<p>
<input type="submit" value="提交">
<input type="reset" value="重置">
</p>
</form>
</html>
网页二
<?php
$con=mysql_connect("localhost","root","");
$sqlname="users_db";
mysql_select_db($sqlname,$con);
$username=$_POST['username'];
$password=$_POST['password'];
$passwordb=$_POST['passwordb'];
$key=$_POST['key'];
if($password==$passwordb)
{
$con = mysql_connect("localhost","root","");
$sql="insert into users(username,password,key)
values
('$_POST[username]','$_POST[password]','$_POST[key]')";
echo "<script>alert('注册成功');</script>";
}
else
{
echo "<script>alert('两次密码输入不一致');history.back();</script>";
}
?> 展开
2个回答
2014-07-31
展开全部
有什么错误?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询