Thanks everyone! However, when I click the "submit" button, the url simply
moves to http://localhost/login.php (from home.php) and it is a blank page
(apart from asking whether it should remember the password for future use).
The values still do not move to the database.

I included most of your suggestions

a) added mysql _error()
b) different names for the variables
c) removed double quotes
d) changed ?> (silly error!)
e) modified the $insert query

The code now looks like this:


// Connect to server and select database.
$host = "localhost";
$user = "root";
$mysql_pass = "abc";
$db = "directory";

mysql_connect($host, $user, $mysql_pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());

// username and password sent to mysql database

$login = $_POST['login'];
$password = $_POST['password'];

$insert = "INSERT INTO user_info
       (login, password)


or  die  ("Unable  to  add user to the database:".mysql_error());


I could insert the values using the command line, and it was updated in
MySQL, but it doesn't work through the form... it just goes to a blank page
on login.php. I'd appreciate any insights on why that's happening.

Reply via email to