PHP 注册代码
$Uname=$_POST["Uname"];
$Pwd=$_POST["Pwd"];
$register=$_POST["register"];
$link=mysql_connect("localhost","root","12345");
if($link)
{
$db_selected=Mysql_Query("use register", $link);
if ( $register="register")
{
if ( $Uname !="" )
{
$result=mysql_query("insert into [user] (Uname , Pwd) values($Uname, $Pwd)" , $link);
echo ("<script>alert('注册成功 !');history.back; </script>");
}
else
{ echo("用户名不能为空!");
}
}
else
{ echo("数据源连接失败!"); }
?>
<form name="form1" action="" method="post">
<input type="text" name="Uname" />
<br/>
<input type="password" name="Pwd" />
<br/>
<input type="submit" value="Register" />
<input type="hidden" value="register" name="register" />
</form>
上一篇: 个人空间上安装phpMyAdmin方法