I am new to PHP and have read numerous threads on data not being passed but I am still confused so I am hoping that someone out there can help me. I believe this has to do with superglobals.
I have a basic login screen with a username and password. The code is shown below:
<form method="POST" action="authenticate.php">
<table>
<tr>
<td colspan="2" class="header">Please enter your login information to access the documents.</td>
</tr>
<tr><td colspan="2"><br></td></tr>
<tr>
<td class="field">Login:</td>
<td><input name="username" type="text" value="" class="textbox"></td>
</tr>
<tr>
<td class="field">Password:</td>
<td><input name="password" type="password" value="" class="textbox"></td>
</tr>
<tr><td colspan="2"><br></td></tr>
<tr>
<td class="field"> </td>
<td><input name="submit" type="submit" value="View Documents" class="button"></td>
</tr>
</form>
The authenticate.php code looks like the following:
<?php
include ("config.php");
$user = $POST['username'];//get username from form
$pass = $POST['password'];//get password from form
$conn = mysql_connect($hostname,$dbuser,$dbpass);
mysql_select_db($database);
$request = "SELECT * FROM user WHERE password='".$pass."' AND username='".$user."'";
$results = mysql_query($request,$conn);
$num_rows = mysql_num_rows($results);
echo "$num_rows Rows\n";
?>
I had just put code in to return the number of rows to test. I keep getting back O when in fact the username and password are in the database.
Any help will definitely be appreciated!