Hi,
I'm trying to create a simple login form!
Here is my INDEX.PHP
include_once('config.php');
include (DIR_INCLUDE.'basicHeader.inc.php');
include_once(DIR_INCLUDE.'init.php'); //initializes the DB
echo '
<form name="form1" method="post" action="authentication.php">
<table class="loginFrame" summary="Innloggings side">
<tr>
<td>Username</td>
<td>
<input class="loginInput" name="username" type="text" size="12" maxlength="10" />
</td>
</tr>
<tr>
<td>Password </td>
<td>
<input class="loginInput" name="password" type="password" size="12" maxlength="10" />
</td>
</tr>
<tr>
<td colspan="2">
<input name="Login" type="submit" value="Login">
</td>
</tr>
</table>
</form>';
include (DIR_INCLUDE.'basicFooter.inc.php');
?>
So far so good.
Now, if I include this at the end in the INDEX.PHP, I get the expected result:
$result = @mysql_query('SELECT empFname, empLname, empUsrName, empPsw FROM employee WHERE empUsrName="test"') or die (mysql_error());
$row = mysql_fetch_array($result);
echo $row['empFname'];
If I include exactly the same lines of code at the TOP of authentication.php I get the following error msg: "No Database Selected"
Why do I loose my DB info / connection when I get the authentication.php file? I have intentionally set empUsrName="test" (for testing purpose).