I have a form that passes in a bunch of variables. On the results page, I am trying to create an array using these variables. Here is my code:
$streetaddress=trim($streetaddress);
$city=trim($city);
$state=trim($state);
$zip=trim($zip);
$storenum=trim($storenum);
$closestprox=trim($closestprox);
$closestn=trim($closestn);
$screen=trim($screen);
$link=trim($link);
$country=trim($country);
$check_1hourphoto=trim($check_1hourphoto);
$check_drivethrurx=trim($check_drivethrurx);
$check_24hour=trim($check_24hour);
$check_gnc=trim($check_gnc);
$check_riterewards=trim($check_riterewards);
$check_picturemaker=trim($check_picturemaker);
$check_photoramp=trim($check_photoramp);
$miles=trim($miles);
$maxshow=trim($maxshow);
$myVars="";
$vars=array('$streetaddress');
for(reset($vars); $key=key($vars); next($vars) ) {
$myVars.= $key . "=" . urlencode(trim($$key)) . "&";
}
How can I make $vars equal to the values of all my variables? I had this working before using the code below, but don't want to use $HTTP_GET_VARS:
$myVars="";
for(reset($HTTP_GET_VARS); $key=key($HTTP_GET_VARS); next($HTTP_GET_VARS) ) {
$myVars.= $key . "=" . urlencode(trim($$key)) . "&";
}
Thanks.