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>
摘自 2012317256