Re: Going back with multiple submits to the same page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Novitski wrote:
At 1/15/2007 01:52 PM, Otto Wyss wrote:
When values are entered on one of my page I submit the result back to the same page (form action=same_page). Unfortunately each submit
adds an entry into the history, so history back doesn't work in a
single step. Yet if the count of submits were known I could use
goto(n). What's the best way to get this count? PHP or Javascript?


What you're suggesting doesn't sound easy.

I know, but what's a better way to to go back?

If you're going to programmatically take the user to a previous page,
say for example if they click a form button within your page, then using JavaScript you could simply walk backward through the window.history() array until you came to an URL that doesn't match with the current page. Of course such a solution would break if JavaScript were disabled so you'd need to build a redundant system server-side to make sure your site didn't break.

My site already heavily depends on Javascript in many places and my
users can be required to have Javascript enabled.

Just looping through history.back() until a different page is reached
could do the trick. Yet is it possible to have a Javascript value across
multiple pages? Has anybody coded something like this?

Since I already store the last different page, I wounder if I could code a loop sever side in PHP which issues Javascript "history.back".

Of course PHP isn't naturally aware of browser history but you could store in the session or cookie the name of the last page in the

I already do and currently I just jump to that page but it would be nice
to go backwards so the user doesn't have to enter the same values all
the time.

functioning of the browser, you could simply let it do its thing and take steps server-side to prevent the user from re-submitting the current form or whatever your goal is.

I thought that too albeit it means to implement XMLHttpRequests instead of submits to get results from the database. Yet for me this seems to be more complicated than just going back through the history. My data is rather large and complicate structured.

O. Wyss

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux