Hi there,

I am creating a login page for my website. The users' information will be
stored in a MySQL database. I have a registration form on my home page, and
a separate file called "login.php" to process the user values. However, the
entries are not going to the MySQL database (even though the values can be
entered successfully using the command line).

I'd appreciate your insight on why the form entries are not making their way
to the MySQL database. Much thanks in advance!

This is the code for the form in home.php:

<form action='login.php' method='POST'>
Username: <input type='text' name='login'><br>
Password: <input type='password' name='password'><br>
<input type='submit' value='Submit'>

This is the code in login.php:

// 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 table user_info in mysql

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

// insert values into table called user_info

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



I hope to develop the form further once the basic submission process has
been ironed out... Thanks again for any insight!

Reply via email to