Hi all,
I am working on a simple registration using php. The problem is that when the form is submitted it does not execute the function registration. Could you please examine and tell me if this is the correct approach? Is there any small error which leads to this?
I have included the whole registration.php file below.
Thanks for reading.
=============================================
[php]<?php
function registration(){
$user = $_POST[“user”];
$pass = $_POST[“pass”];
$connect = mysql_connect(“localhost”, “user”, “pass”);
if(!$connect){die(mysql_error());}
$select_db = mysql_select_db(“database”, $connect);
if(!$select_db){die(mysql_error());}
$insert = mysql_query("INSERT INTO users (username, password) VALUES (’$user’, ‘$pass’) ");
if(!$insert){ die("Error: ".mysql_error());}
echo $user.", welcome.
Login";
}
?>
Password: