Hi, i have a login form which works and happily goes to the homepage.php if username and password are correct.
But i want to display on homepage.php $user_id and $tel_ext so it displays Adam Bell and 1220.
But it doesnt seem to want to pass the variables over. on the homepage i have an SQL statement saying:
$sql = "SELECT user_id, tel_ext FROM employee WHERE result_id='$user_id'";
so it displays the user_id and tel_ext on the page.
I think it doesnt pass the variables over because i am not submitting anything from login.php to homepage.php. I just add a header(Location:www.wherever.com);
If i try to put an echo "<input type=\"hidden\" name=\"result_id\" value=\"$user_id\">";
it produces an error saying.
Warning: Cannot add header information - headers already sent by (output started at c:\dev\intranet\validate_login.php:15) in c:\dev\intranet\validate_login.php on line 16
which
<?
switch( $do )
{
case "authenticate":
include ("valcon.php");
$sql = "SELECT result_id FROM user WHERE password='$password' AND user_id='$user_id'";
$result = mysql_query($sql, $connection) or die("Couldn't execute query.");
$num = mysql_num_rows($result);
if ($num == 1)
{
header("Location:http://apachedemo/intranet/homepage.php");
}
else if ($num == 0)
{
unset($do);
include("badlogin.php");
}
}
?>