php login form error help!!!?

Jacob

New member
alright so i am doing a login form and when i go to preview it there are no errors but when i hit login i get errors. the errors look like this:

Notice: Use of undefined constant username - assumed 'username' in C:\wamp\www\register
improved02\login.php on line 6

Notice: Use of undefined constant password - assumed 'password' in C:\wamp\www\register improved02\login.php on line 6


and this my code so far:

<?php

$username = @$_POST['username'];
$password = @$_POST['password'];

if (username&&password)
{

$connect = mysql_connect("localhost","root","") or die("couldn't connect!");
mysql_select_db("phplogin") or die("couldn't find db");


}


?>
 
I think you want to change this:
if (username&&password)

To this:
if ( (strlen($username) > 0) && ( strlen($password) > 0) )

Also, notice that you didn't include the dollar sign ('$') in your initial statement for the variable names.
 
Back
Top