How about (probably one of fifty solutions; Foreach($_POST as $k => $v) $vals[] = $k."=".$v; $strvals = urlencode(implode("&",$vals)); Header("Location: https://example.com/script.asp?".$strvals);
One thing to think about, URL's are limited in length, and one reason for using method=post is that they won't fit in a URL, for this you'll need to make sure they fit. Warren Vail -----Original Message----- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 12:32 PM To: Jeff Oien Cc: PHP Subject: [PHP] Re: Putting $_POST into string to send to ASP Jeff Oien wrote: > Dumb question, sorry if it's a repeat. I will use PHP for a form with > error checking. When there are no errors I need to send all the > variables thru something like this: > > $URL = "https://example.com/script.asp?First=Jim&Last=Smith"; > urlencode($URL); > header("Location: $URL\n"); > > How do I gather up all the variables in $_POST and attach them as a > string after the question mark? Thanks. > Jeff Try the http_build_query() function. If you don't have PHP 5, look in the user notes--someone appears to have written one for PHP 4 as well (the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one. http://www.php.net/manual/en/function.http-build-query.php Using this, you could just do something like: $query_string = http_build_query($_POST); Hope this helps, Torben <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php