Reset the $_POST after submitting a save session?

Good day!

There is a form that is processed on the same page. After you submit the form to a variable the result is written and displayed in the code below.

The question is: if after sending the form to do a redirect via header(), how to preserve the value of the variable on successful send?

If you use the session variable is the same on all pages with forms. If you write a value in session, then how can and dump it on other pages? It turns out, if you reset it in the beginning of the code, it cleaned up and the current value. Or I something not understand?

Thanks in advance!

Clarification: to Move the script processing to another file is not an option. Unfortunately, it is not an option
April 19th 20 at 12:44
1 answer
April 19th 20 at 12:46
Solution
Well, just to check, and reset
if (!empty($_SESSION['blabla'])) {
 $blabla = $_SESSION['blabla'];
unset($_SESSION['blabla']);
}
@Adelbert.Lockm Yes, but if the variable I is replicated on all pages, then will repeat the name of the session.

Ie on one page I've submitted a form, everything is OK, recorded in $_SESSION['blabla'].

Then go to another page with the same session variable and in the script, and there is this check sees that the variable is and shows it without submitting a new form. - Richie commented on April 19th 20 at 12:49
why?
I repeat in bold:
to check whether, and to reset - Adelbert.Lockm commented on April 19th 20 at 12:52
@Adelbert.Lockm, damn, I don't know how to put a smile "hand-face". Yes, sorry. Misread Your answer. Thank you! - Richie commented on April 19th 20 at 12:55

Find more questions by tags PHP