PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Im writing the form validation portion of an online store, and have run into a problem. When the user clicks the button to go onto the next "step" in the ordering process, it checks the input and if its not correct it redirects them (header("location: ...")) back to the page and spits out the errors with the input. The problem is when you redirect like this all post variables die, im wondering if anyone knows a way or workaround for this? Thanks,
$array = array("foo"=>"bar", "bar"=>"mofo");
$tmp = serialize($array);
header("Location: next.php?info=".$tmp);
// then on next.php, unserialize, and do whatever...
Or use serialize(), convert the resulting string to base64 with base64_encode(), add it to your URL, and then base64_decode() and unserialize() it on the other end ... you can preserve anything but resource handles this way... only downer is that you end up with a big, long, ugly URL.