N
N
nezzard2013-11-18 18:53:36
PHP
nezzard, 2013-11-18 18:53:36

How to clear $_POST after page load?

Hello everyone, I can't clear $_POST after page load.

Form - Passing $_POST to itself - Then the script works, and it is necessary that $_POST be cleared when the page is updated, trying unset does not help. How to make $_POST only work for 1 page load?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
C
codercat, 2013-11-18
@nezzard

In general, try to redirect to the same URL, if I understand your problem correctly.
For example:
header('Location: /test.php');

N
Nikita Gusakov, 2013-11-18
@hell0w0rd

Read the http specification. $_POST is just a variable that php fills with the next request. If a POST request receives a 200 response, the browser saves the previously sent data in order to send it again before the GET request.
And the fact that you have an error falls out - look for where you call echo, or any other function that sends information to php: // stdout

K
Kirill Firsov, 2013-11-18
@Isis

Redirect to the same page after a POST request.

Q
Quber, 2013-11-19
@Quber

I could be wrong, but try unset($_POST);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question