Page 1 of 1
PHP/MYSQL using back button forces a refresh of page
Posted: Wed Feb 18, 2004 6:24 am
by muppet
Hi,
I have a series of sequential pages using forms (data pulled from recordset) to submit data selected by the user which is gathered at the end to create a query. This all works fine. However, if the user wants to go back a page (using back button) to change selections the browser wants a refresh. Can I stop this from happening?
I know it's to do with the forms but not how to stop it.
Do i need to look at some way of holding these selections in php $variables???????
From: Confused, Frustrated and not sure about PHP.......
Posted: Wed Feb 18, 2004 6:31 am
by d3ad1ysp0rk
can you post your code so we can better understand what you need help with?
Posted: Wed Feb 18, 2004 7:27 am
by muppet
Cann't really send to code - but I've found out what's causing the refresh - I'm using a session variables to grab the users ID, name and login status when they login and to protect the pages from someone not logged in. If I turn the session_start off then the refresh issue is solved but I've lost access to my session variables.
Is there a way to bypass this so that I can keep my security on the pages? Something along the lines of grabbing the userid etc at login and placing it in a "normal" variable in an include file then checking this instead of the session var????
FROM: not quite so confused...........
Posted: Wed Feb 18, 2004 11:12 am
by tylerdurden
You'd have to use a GET action in the form instead of POST.
Posted: Wed Feb 18, 2004 12:07 pm
by muppet
HHHHHMMMMMMM..........THANKS
So I would need to use a url string to pass all the form variables instead of using a submit action on a button?????
And this will still work with a session started?
FROM: showing his ignorance
Posted: Wed Feb 18, 2004 4:49 pm
by tylerdurden
muppet wrote:HHHHHMMMMMMM..........THANKS
So I would need to use a url string to pass all the form variables instead of using a submit action on a button?????
Just change the form's action parameter from POST to GET and you'll end up with an url like page.php?var1=xyz&var2=zyx
Visit Google and search for something, then check your browser's url bar.
And this will still work with a session started?
FROM: showing his ignorance
Yes, the sessionID should be stored in a cookie. Or it is be added to the transmitted form data, be it via POST or GET
Posted: Thu Feb 19, 2004 2:47 am
by muppet
Thanks,
Do you ever feel like a fool for not looking at the obvious and most basic -I do now..........
Ta muchly
FROM: Hanging his head in shame
Posted: Thu Feb 19, 2004 2:51 am
by tylerdurden
I remember being very amazed when I discovered this some time ago.