开发者

Posting array and redirecting to another page

I have signup form that posts all variables to signup.php. What I want to do is, during submit process collect all error codes to $err[] array and if submit process failed redirect user to msg.php and post $err array.

Then msg.php gets error messages from database with sent error codes from signup.php.

How can I pass array and redirect page to msg.php ? Is it possible with Location: header or somethi开发者_开发技巧ng else?


Your architecture is wrong. You should not redirect a user to another page just to show the error messages. Why cant you just show the error messages on the same page.

Consider altering your application flow. But if you insist on doing something like this then you can use sessions for this. In signup.php if validation fails

if(!validation)
{
$_SESSION["err"] = $error;
}

Then in msg.php you can access the session variable easily as

foreach($_SESSION["err"] as $err) {
echo $err;
}

But if this is what you intend to do there is much better ways to do this and consider altering your flow to do in a better way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜