I am currently trying to make a log in page for my website i am following this tutorial on youtube http://www.youtube.com/watch?v=4oSCuEtxRK8
however i currently have a problem
<form method="POST" action='login.php'>
Username<input type='text' name='username'></br>
Password<input type='password' name='password'></br>
<input type='submit' value='Log in'>
</form>
and my login page code atm is
<?php
$username = $_ POST('username');
$password = $_ POST('password');
if ($username&&$password)
{
$connect = mysql_connect("localhost","root","")or die ("couldn't connect");
mysql_select_db("mylogin") or die ("could not find the database");
else die("please enter a username and password");
}
?>
it says that i have got a promeblem at line 3 in my login page which satrts $username it gives me a T_string error saying that it does not recognise username or password.
login page php
Moderator: General Moderators
Re: login page php
You reference an array item using brackets, not parentheses.
Any tutorial advocating the use of mysql_connect et al. isn't worth following.
Code: Select all
$username = $_POST['username'];Re: login page php
i tried that as well this is the error message that comes up Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\prototype\login.php on line 3
Re: login page php
You've got the same mistake on the very next line, and you've got your else statement inside your if block.