I need help I am going by this video tutorial
http://www.youtube.com/watch?v=4oSCuEtxRK8&list=PL7C9AFC3942AC8E40&index=1&feature=plpp_video
which I have mimicked the coding letter for letter outside of changing the mysql login information to mirror the information from my account.
I have the database name as the one pre-assigned by 000webhost and in that I have the table ‘users’ which has 3 data fields, id, username and password. In that I inserted a test username and password.
I have checked over and over again, and made adjustments to the coding that was given to see if I had made an error but Im just not finding it, when comparing to his work.
What happens is at the very end, when he enters his own test username and password, it gives him a blank page because it was successful…
Thats not happening for me… Im getting the die statement “please enter a username and a password”… even though I know I am typing in my test username and pass correctly…
Here is my code (Ive removed my login information and replaced with cap letters) for my logintest.php file
<?php
$username = $POST['username'];
$password = $POST['password'];
if ($username && $password){
$connect = mysql_connect('mysql10.000webhost.com', 'USERNAME', 'PASSWORD') or die("Couldn't connect!");
mysql_select_db('DATABASE NAME') or die("Couldn't find DB");
}
else
die("Please enter a username and a password!");
?>
If needed heres my index.php code:
<html>
<form action='logintest.php' method="POST">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="Log in"><br>
</form>
</html>
Also, I have tried to generate any of the errors in the if statement by altering the log in information so that it should obviously not connect to the database, but I still get taken to the else statement. Its making me think its not even making it that far… so the problem has to be elsewhere but I dont know where.
any help would be greatly appreciated! thanks!