View Full Version : Passing *hidden* POST variables in a redirect?

09-22-2005, 12:59 AM
Let's say I want to have a user fill out a form on myserver.com, process it to check a few variables on myotherserver.com, add some variables to the mix, then submit the whole shebang to myserver.com again within a redirect, so it's like the user submitted the results of the script on myotherserver.com to a script on myserver.com.

Now, I can do this where myotherserver.com puts up a page with the re-constituted form on it and asks them to click a button to finalize their submission, but that adds a step to the process for the user.

I can do this using a Location: redirect, carpentering the vars onto the end of the URL (i.e. ("Location: http://myserver.com/process.php?var1=5&var2=7")) but I don't want the user to see some of the vars that were added and I want the vars available to the script on myserver.com as $_POST['var1'] and $_POST['var2'].

Doing behind the scenes posting with fsckopen() or curl() doesn't work, because that posts the variables to myserver.com, but doesn't redirect the user to the output of the script on myserver.com. I could proxy the output from the second script back to the user, but they remain on myotherserver.com.

So how do I do this? Is it even possible?

- Greg

09-22-2005, 05:40 AM
Well, I'm not the best person to ask the mechanics of how to do this, but is it possible to use sessions and cookies as a way of navigating between the sites with those variables?

09-22-2005, 07:30 AM
sessions wouldnt work because you're moving between 2 servers.
The best way t do it would be to encrypt your querystring.