|
Posted by The Natural Philosopher on July 12, 2008, 4:57 pm
Please log in for more thread options Michael Fesser wrote:
> .oO(The Natural Philosopher)
>
>> chochote@gmail.com wrote:
>>> Hi,
>>>
>>> I have a PHP script that does some processing, and stores an error
>>> message as a variable. The script then redirects to another script
>>> with the error string in the URL, with the second script displaying
>>> the message and continues with the rest of the logic.
>>>
>>> Now I want to hide the error message from the URL, but the second
>>> script needs to continue working as is. How can I do this? I have
>>> thought about md5'ing the message but the URLs still look messy. Any
>>> other alternatives?
>>>
>>> The script works like this;
>>> $err = "";
>>> $res = process();
>>> if ($res == 0)
>>> {
>>> $err = "An error message";
>>> }
>>> header("Location: script2.php?err=".urlencode($err));
>>>
>>> Script2.php would display this message and continue with the rest of
>>> the logic. Now I want to hide the Error message $err from the URL
>>> after a redirect. How do I do this?
>>>
>>> Thanks in advance.
>> Use POST method.
>>
>> Declare a form, and set a hidden variable err
>
> You can't redirect a POST request.
Are you sure?
>Sessions are the way to go here if
> the error code shouldn't appear in the URL.
>
> Micha
|