S
S
SimBioT192015-09-29 11:09:44
PHP
SimBioT19, 2015-09-29 11:09:44

How to solve the problem after sending POST?

Everyone knows the message

Чтобы отобразить эту страницу, Firefox Developer Edition
должен отправить информацию, которая повторит любое ранее произведённое действие 
(например, запрос на поиск или онлайн-покупка).

I know that after sending a POST, you need to redirect the user to another page, but this option is not suitable in my case: there is an account entry in the site header and after the person has logged in, I can’t just transfer him to another page, they won’t understand, - entered on one page, ended up on another. How do you solve this problem?
UPDATE
Thanks for the replies, didheader('Location:#');

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Pavel Shcheglov, 2015-09-29
@webfarrock

You can direct the user to the same page.
After processing the submitted form in the php script, write the header location of the same page from which the submission took place. After that, the form will not be resubmitted.

O
Optimus, 2015-09-29
Pyan @marrk2

When I log into my account, I expect to be on a different page! You do a redirect either to yourself or to the desired one and that's it.

K
Kirill Turovnikov, 2015-09-29
@turovnikoff

Use ajax to avoid page reload api.jquery.com/jquery.ajax

P
Pavel Volintsev, 2015-09-29
@copist

If you need to stay on the same page

<?php
if (/* login success */) {
   header("HTTP/1.1 205 Reset Сontent");
}

You can't redirect anywhere. The browser will forget that it sent the data using the POST method. If you reload the page, the "Form needs to be resubmitted..." messages will not appear.
If you need to go to another page, but in order not to appear "To display this page, XXX must send information ..." when he presses the "Back" button in the browser
<?php
if (/* login success */) {
   header( 'Location: /* new location*/', true, 205);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question