L
L
Lev Rozanov2020-04-18 20:36:30
PHP
Lev Rozanov, 2020-04-18 20:36:30

Resetting $_POST after submitting while saving the session?

Good day!

There is a form which is processed on the same page. After submitting the form, the result is written to the variable and displayed in the code below.

The question is this: if after submitting the form to do a redirect through header (), then how to save the value of the variable about successful submission?

If you use session: the variable is the same for all pages with forms. If you write a value to the session, then how to reset it on other pages? After all, it turns out that if you reset it at the beginning of the code, then it will also clean up the current value. Or am I misunderstanding something?

Thanks in advance!

Clarification: Transferring the processing script to another file is not an option. Unfortunately not really an option.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-04-18
@MetisKot

Well , just check if it is installed and reset

if (!empty($_SESSION['blabla'])) {
    $blabla = $_SESSION['blabla'];
    unset($_SESSION['blabla']);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question