Home >Backend Development >PHP Tutorial >PHP registration code_PHP tutorial
PHP registration code
$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('Registration successful!');history.back; </script>");
}
else
{echo ("The user name cannot be empty!");
}
}
else
{ echo("Data source connection failed!"); }
?>
Excerpted from 2012317256