juls Posted March 17, 2007 Share Posted March 17, 2007 when i use header('Location : example.php") to redirect...in some pages it works fine and in others it gives error like header already started in some line..cant send header... help!! Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/ Share on other sites More sharing options...
paul2463 Posted March 17, 2007 Share Posted March 17, 2007 ('Location : example.php") you can only use this when nothing has been written to the page at all, if you have echoed anything out then it wont work Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209511 Share on other sites More sharing options...
juls Posted March 17, 2007 Author Share Posted March 17, 2007 oh... so if i have echoed then wat should i use instesd of header('location: ');???? Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209513 Share on other sites More sharing options...
idevlabsdotcom Posted March 17, 2007 Share Posted March 17, 2007 that includes using html before you use php. the following will throw an error: <html> <body> This is outputting text! Now I can't use a header call! <?php header("Location: www.yoursite.com"); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209514 Share on other sites More sharing options...
idevlabsdotcom Posted March 17, 2007 Share Posted March 17, 2007 oh... so if i have echoed then wat should i use instesd of header('location: ');???? you could echo a javascript redirect along with some text that says to click if they are not automatically redirected. Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209517 Share on other sites More sharing options...
shaunrigby Posted March 17, 2007 Share Posted March 17, 2007 Google meta refresh to auto-refresh a page and send it to a different link, just out of curiousity what are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209557 Share on other sites More sharing options...
suzzane2020 Posted March 17, 2007 Share Posted March 17, 2007 If you can place all the header function rite at the beginning of the file..before any html..it wud work Quote Link to comment https://forums.phpfreaks.com/topic/43143-headerlocation-problem/#findComment-209562 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.