开发者

php Header to redirect when post - redirect troubles

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

The above needs to redirect the user when a form is submitted, using a hidden variable for _parent_id.

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

Any ideas?

PS. Im certain that $_POST['parent_id'] has a value.


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

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

But it must be something else because your code looks ok. Are you shure that you are redirecting from that point and not from another? Have you tried putting a die() just before that redirection?Most of the times i had your problem i wasn't redirecting from the right place!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜