Jump to content

Archived

This topic is now archived and is closed to further replies.

Hardbyte

Sessions and Refreshing

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Bump?

Anyone shed any light on this? Was trying to wash my hands of it over the weekend?

Thanks for any advice.


Hardbyte

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.