The below code represents a basic login page. I'm pulling the user ID and password from a MYSQL database. That works fine. I can get stuff to echo authentication. What I can't seem to do is use the 'header' to automatically pull up another page. Seems pretty straight forward ... but I keep getting error messages that read "Cannot add header information - headers already sent by ..." Any suggestions?
Thanks
Paul
paul@tanaka-ism.com
<form action="welcome.php" method="get">
<table align=center width=500 cellpadding=5 border=5><tr><td bgcolor=#ee7218 align=center>
<font size=2 face=verdana,arial><b>ENTER YOUR USER ID and PASSWORD</font></td></tr>
<tr><td align=center>
<font size=2 face=verdana,arial>
Dealer ID: <input type="Text" size="8" name="searchvalue" maxlength="5" value="<?=$HTTP_GET_VARS['searchvalue']?>">
Password: <input type="Text" size="5" name="searchvalue2" maxlength="4" value="<?=$HTTP_GET_VARS['searchvalue2']?>"> <input type="submit" value="Go">
</td></tr></table>
</form>
<?php
$dbcnx = @mysql_connect("XXXXXXX", "XXX", "XXX");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " . "database server at this time.</P>" ); exit();
}
mysql_select_db("XXXXX", $dbcnx);
if (! @mysql_select_db("XXXXX") )
{ echo( "<P>Unable to locate the " . "database at this time.</P>" );
exit();
}
$searchterm = $HTTP_GET_VARS['searchvalue'];
$searchterm2 = $HTTP_GET_VARS['searchvalue2'];
$result = mysql_query("SELECT * FROM dealern WHERE dealerno = '$searchterm' AND password = '$searchterm2'",$dbcnx);
if ($result) {
header('Location: /loggedin.php');
exit;
}
else {
..
}
?>