Re: Using Header() to pass information...
| From: | Tim Van Wassenhove | Date: | Sat, 22 Apr 2006 22:40:05 +0000 |
| Subject: | Re: Using Header() to pass information... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234571@lists.php.net to get a copy of this message | ||
On 2006-04-22, Todd Cary <todd@aristesoftware.com> wrote:
> If I use
>
> if ($send)
> header("location: mypage.php?message=" . $message);
>
> the data ($message) is passed in the URL. Is there a way to pass
> the data as though it was a POST method i.e. not in the URL?
It's impossible to change the HTTP method. So if your user-agent is
performing a GET request, a location header would result in another GET
request. Thus, unless you are using a POST method (which is odd since
you wrote that the variables are in the URL) it's not possible.
What you could do is write it into $_SESSION (and call
session_write_close before you redirect)
Or you could stuff it yourself in $_POST and include/require mypage.php
Btw, there are browsers that don't handle a relative URL for redirection
very well. I suggest that you use an absolute URL (as written in
RFC2616 section 14.30)
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>