Page 1 of 1
Sending POST variables through header(location..?
Posted: Wed Dec 18, 2002 9:00 am
by fjonte
What I would
like to do is something like this:
Code: Select all
header("Location:index.php?message=".$message."&id=".$id);
but I want to have
lots of variables, and I want to send them like $_POST variables, not like $_GET.
Or maybe create a form and posting it, but without sending it to the client first.
I would also like to do stuff like add a target="_blank" somewhere.
Is there any way to do this?
Posted: Wed Dec 18, 2002 12:36 pm
by Takuma
You can't really do target="_blank" but you can do another one:-
You could use for and loop it. Put all the name of the value into an array and loop that variable.
Posted: Wed Dec 18, 2002 1:47 pm
by hedge
You could submit a post over a socket connection but you would have to build the html headers yourself.
I have seen an example on the php.net site, I believe it's under fsockopen()
Posted: Wed Dec 18, 2002 3:28 pm
by kcomer
why not store all the variables in an array and store the array as a session variable. Then just call the session variable on the page you redirected to and then kill the session variable once you don't need it.
Posted: Wed Dec 18, 2002 10:55 pm
by persaltier
instead of worrying about arrays....store each variable as a session variable before redirecting the user using the header() function, then initiate the session on the subsequent page and grab at the stored session vars.
Code: Select all
<?php
while(list($k, $v) = each ($_POST)){ //add all POST variables to the SESSION
$_SESSION[$k] = $v;
}
?>
change $_POST to whatever method you've used to get to the page you're on that will be supplying the header() function.
?>
Posted: Thu Dec 19, 2002 2:01 pm
by superwormy
I too want to do this... what does an HTTP header for post variables actually look like?
I dont' mind building the HTTP headers myself...