faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 17 people (71%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

When using Header function to redirect to another page its not redirecting me to anywhere. DOn't understand the problem

Dec 26th, 2005 06:28
Praveen Kumar Kukkapalli, Rich Cavanaugh, Sabya Sachi,


Be sure you're using it correctly:
<?php
header('Location: http://www.mysite.com/mypage.php');
?>
You may want to look at 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html and do a search 
for 'Location:' on that page.
Also, make sure you're not outputting any text before the header() 
call. Headers must always come before text output.
you should not write anything on to the browser before using header()
function, otherwise it will give an error bacause browser expects teh
header information as the first thing to be passed.