DKY Posted January 26, 2007 Share Posted January 26, 2007 I'm trying to use header like so[code]header('Location: http://www.example.com/');[/code]but it doesn't work. I look in my address bar and it is still the address of the original file. But if I put something like[code]echo "yo";[/code]it echos out the response. I don't get it, help??? Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/ Share on other sites More sharing options...
matfish Posted January 26, 2007 Share Posted January 26, 2007 [code]<? header('Location: http://www.example.com/'); ?>[/code]Works for me, is it at the very top of your page before you have echo'ed anything to the screen? Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169787 Share on other sites More sharing options...
DKY Posted January 26, 2007 Author Share Posted January 26, 2007 I'm trying to put it in an else of an if then statement. Can I do that? I thought I could but if it has to be at the top of a page then I can't, right? Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169860 Share on other sites More sharing options...
Orio Posted January 26, 2007 Share Posted January 26, 2007 Can you post the full code?Orio. Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169861 Share on other sites More sharing options...
DKY Posted January 26, 2007 Author Share Posted January 26, 2007 I can PM it..... If that's okay Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169863 Share on other sites More sharing options...
kenrbnsn Posted January 26, 2007 Share Posted January 26, 2007 No, post it in the forum so everyone can take a look at it. This is a community and the only way the community can help you is for you to post your code publicly. Just hide any sensitive code.Ken Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169883 Share on other sites More sharing options...
DKY Posted January 26, 2007 Author Share Posted January 26, 2007 Hiding would have been too much and I wouldn't want links to someone's page out on the net but just to give an idea of what I was doing, I was trying to use header in a nested IF statement.ob_start();worked! I just put it at the top of my page and I can use the header in my nested if! That's awesome! Thanks for the help though!I wonder if I need an Exit or not.... Link to comment https://forums.phpfreaks.com/topic/35816-cant-get-header-to-work/#findComment-169888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.