faqts : Computers : Programming : Languages : PHP : Common Problems : Redirects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

How to do a redirect with all (unknown) $_GET parameters?

Oct 8th, 2006 14:30
Matthew Wilkinson, Mr. Friendly,


$querystring = '';
$n = 1;
foreach ($_GET as $key=>$value)
{
if ($n !== 1)
{
$querystring .= '&' . $key . '=' . $value;
}
else
{
$querystring .= $key . '=' . $value;
}
$n++;
}
header('Location: page.php?' . $querystring);