[thelist] PHP header() for post variables

Anthony Baratta Anthony at Baratta.com
Thu Sep 5 00:04:01 CDT 2002


At 09:08 PM 9/4/2002, David Bindel wrote:

>I am in a situation where I need to redirect a user to another page but also
>send HTTP POST variables to that page using PHP (I'm assuming using the
>header() function).  I'm sure somebody out there knows how to do this.

I don't think you can redirect to another page AND post to that page. You
can, of course, stuff the information into the URL - but that maybe not be
workable with the data you want to send. (Plus you'll need to URL encode
all the data.)

It's because the browser is the one dealing with the new page. You (the
server) says go "here" and the browser goes and gets that page. But posting
to that page at the same time, is not part of the communication because all
you have time to tell the browser is go "here". The browser will ignore the
rest.

One option maybe to post to the page "server to server" and deal with
accordingly. Another option would be to save the information to a session
object and then redirect. The target page can look for the session object
and work on the data then.

(If I'm wrong some here will correct me. ;-)
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list