Maison >développement back-end >tutoriel 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("数据源连接失败!"); }
?>