Christian Hänsel wrote:
> Hi guys,
> 
> this might be a noob- question, but I simply do not care anymore. After
> a few hours of fiddling with this @/**&%$ (screaming "AAaaaaahhhh"), I
> would like to ask you.
> 
> So what I have is this: I have a search engine for a car market, which
> has about 30 $_POST- vars. Now when the user clicks on a result link, it
> takes him to the car details page. Now when he hits the back button, he
> either gets the "Page has expired" (IE) or the "Wanna send the form data
> again" message box (FF).
> 
> Now I would like to have kind of a "back-button", so the user will see
> the reusult list again without having to deal with this.
> 
> I guess what I'm asking for is a one-click re-submission of POST data...
> Do you have a clue on how to do this?

OK, you generally use post data when you want to update something - e.g.
change a value in a database or similar.

For searching, POST is generally a bad idea as it will block search
engines from indexing past the form.

That aside, if you really do want to use POST there is a technique you
can use to not break the back button, which is roughly as follows:

1. Create a form which POSTs data.
2. On the handling page, take appropriate action (update DB, write file,
store info in session.
3. Issue a "header('Location: http://server/page');" to redirect to a
new page which will do the necessary output of page content (perhaps
based on the db update/session vars from the actual script handler in
step 2).

By doing the header it will cause the browser to ignore the POST handler
in terms of it's page history and so when the user hit's "back" it works
as expected.

Hope this helps.

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to