Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem: Redirecting

Status
Not open for further replies.

alsaffar

Programmer
Oct 25, 2001
165
KW
Hi guys,

I have a problem of redirecting, and this is part of my script where the error occurs:

<?

if ($login == 'Ok')
{
?>
<HTML><HEAD><TITLE>You're Logged In!</TITLE></HEAD>
<BODY><CENTER>Congratulation You're logged in</CENTER></BODY></HTML>
<?
}

header (&quot;Location: UserControlPanel.php&quot;);

?>

It gave me the following error:

Warning: Cannot add header information - headers already sent by (output started at /path/to/the/file/login.php:120) in /path/to/the/file/login.php on line 182

I want it to work just like how it's working in any forum when you login to the forum, it redirect to a temp page telling you &quot;Thank you for login&quot; and then redirect to the forum sections or your control panel. How can I do something like this?
 
To make the redirection delay, you have to use a refresh header. This can also be done using HTML, with a tag like
Code:
<meta http-equiv=&quot;refresh&quot; content=&quot;5;url=URL&quot; />
The 5 indicates how many seconds it should delay. Replace URL with the URL to the document you want to redirect to.
To send this as a header, use
Code:
header('Refresh: 5; url=URL');
Same rules applies here too. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top