PHP redirect header for redirect problems

header('Location: ../pages/my-files.php?parent_id=' . $_POST['parent_id']);

The above should redirect the user when submitting the form using a hidden variable for _parent_id.

However, for some reason, the user is redirected (or seems to be browsing the browser URL) simply ../pages/my-files.php

Any ideas?

PS. I'm sure $_POST['parent_id']it matters.

+3
source share
1 answer

Have you tried to encode $ _POST ['parent_id'] for use in the url?

header('Location: ../pages/my-files.php?parent_id=' . rawurlencode($_POST['parent_id']));

- , . , , ? die() ? , !

+3

All Articles