Home php How to go back to two pages, without a button and after...

How to go back to two pages, without a button and after 5 seconds?

Author

Date

Category

The registration form is not called on all pages, so it was necessary to return to the one from where they came from … But not one, and two pages, since when processing the form a message is displayed, like “You are successfully registered” to 2 – Already the page … How to return to two (several) pages correctly, not prescribing a specific address?


Answer 1, Authority 100%

You can via JavaScript

function back () {
  document.history.go (-2);
  }
setTimeout ('back ()', 5000);

Answer 2, Authority 33%

In the form of registration Make +1 field

& lt; input type = "hidden" name = "backurl" value = "& lt;? = $ _ Server [' Http_referer ']? & Gt; " / & gt;

in the message:

...
? & gt; & lt; p & gt; You have successfully registered! & lt; / p & gt;
& lt; script type = "text / javascript" & gt;
setTimeout (function () {top.location.href = '& lt ;? echo (! empty ($ _ post [' backurl ']))? $ _post [' backurl ']:' / ';? & gt;';}, 5000);
& lt; / script & gt;
& lt;?
...

Answer 3

Some, most likely, so can be used

$ _ Server ['http_referer']
+
SuperGlobal $ _Server array

Do not forget, Refer must be checked, and among other things – you need to save it, session, cookies – how more like it.

UPD:

To go back …

& lt; Meta http-equiv = "refresh" content = "seconds; url =" address "& gt;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions