Hardbyte Posted May 17, 2006 Share Posted May 17, 2006 Hi-ya.Iv got this admin system and depending on what button(which directs you to a page) you press, it saves a session of that page name. This session only appears to "update" and be stored when I refresh the page for a second time.Iv tried using the "header("Location: ..." however I get errors as the header is already being used by another script somewhere.Any ideas on how to refresh the whole page when Iv pressed the button that stores the session page name?Hope someone can understand the above lol, Its been difficult trying to explain what the issue is.Thanks in advance.Hardbyte Quote Link to comment https://forums.phpfreaks.com/topic/9876-sessions-and-refreshing/ Share on other sites More sharing options...
alpine Posted May 17, 2006 Share Posted May 17, 2006 Nothing is to be outputted to the browser before a header command, that is a message, space, linebreak etc [i]anywhere[/i] in the script or in included scripts before the header call is made. Example if you put the php start tag on line two in a script, this is enough to fail headers. This is a very common issue and there is a pinned post on this issue [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=63200\" target=\"_blank\"]HERE !![/a].I would say that good practice is to [u]always[/u] do the php start tag in the absolute top left corner on any php script you write.As an alternative to header you can use <meta http-equiv="refresh" content="{$time}; url={$target}" />where time is in seconds, set it at 0 and it's instant redirect. Quote Link to comment https://forums.phpfreaks.com/topic/9876-sessions-and-refreshing/#findComment-36755 Share on other sites More sharing options...
Hardbyte Posted May 19, 2006 Author Share Posted May 19, 2006 Hi - Thanks for the reply. Iv read the articles you mentioned but Im still not getting anywhere.Iv got includes and headers. In the header its already setting a session of the login.Now, for example: when button1 is pressed its stores button1 as the value in a new session. If button2 is pressed, button2 is stored in that session instead.But these only work when the page is "Ctrl + F5" refreshed after the button is pressed. So like it needs refreshing before it works?Does that make any sense to anyone? I either need to refresh the whole pages including headers when the button is pressed, or header: location needs to work - but it wont as it says is already being sent??!Thanks in advance.Hardbyte Quote Link to comment https://forums.phpfreaks.com/topic/9876-sessions-and-refreshing/#findComment-37121 Share on other sites More sharing options...
Hardbyte Posted May 19, 2006 Author Share Posted May 19, 2006 Bump?Anyone shed any light on this? Was trying to wash my hands of it over the weekend?Thanks for any advice.Hardbyte Quote Link to comment https://forums.phpfreaks.com/topic/9876-sessions-and-refreshing/#findComment-37314 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.