All about headers..cuz i m a noob
Posted: Wed Dec 03, 2003 12:40 pm
Hi 
Okay basically i need to use a header to redirect a user when he put a good or bad user name...
so basically i did that
that s my code...
now in my if instead of puting Good login.. i want to redirect to a page...
but it : Warning: Cannot add header information - headers already sent
i know that header should be in head (or befor anything else) but still i need to put my redirect in the if... so any suggestion
thank you
Okay basically i need to use a header to redirect a user when he put a good or bad user name...
so basically i did that
Code: Select all
<?php
$connect = mysql_connect($host, $user, $pswd)
or die("Could not connect: " . mysql_error());
$database = mysql_select_db('tech_support')
or die(MySQL_Error());
$sql = "SELECT * FROM members";
$result = mysql_query($sql) or die(MySQL_Error());
for ($i = 0; $rows = mysql_fetch_row($result); $i++)
{
if ($rows[1] == $_POST["user"] && $rows[2] == $_POST["password"])
{
print "Good login...i won't kill you<br />";
}else{
print "BAD USER OR PASSWORD YOU LOOSER<br />";
}
}
mysql_close($connect);
?>now in my if instead of puting Good login.. i want to redirect to a page...
but it : Warning: Cannot add header information - headers already sent
i know that header should be in head (or befor anything else) but still i need to put my redirect in the if... so any suggestion
thank you