PHP 注册代码
?
<?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>