Jump to content

[SOLVED] $_REQUEST VARS in URL


l!m!t

Recommended Posts

Hello everyone,

 

Quick question as I am confused once again on how to search or figure this out

 

If I had a bunch of $_REQUEST variables in an array is it possible to some how send them in a URL.

 

Example: Say my REQUEST vars are the following.

 

array(
'Test1' => $_REQUEST['Test1'],
'Test2' => $_REQUEST['Test2'],
'Test3' => $_REQUEST['Test3']);

 

Is there any way to put them into a URL without individually adding $_GET vars?

 

http://mysite.com/?Test=<?= $_REQUEST['Test1']?>&Test2=<?= $_REQUEST['Test2']?>&.... so on

 

I am wanting some sort of function to convert them.

 

http://mysite.com/?<?=$my_output?>

 

Is this even possible is there an easier way?

 

 

Link to comment
https://forums.phpfreaks.com/topic/144196-solved-_request-vars-in-url/
Share on other sites

you would need a foreach loop like this

$url = "";
foreach($_REQUEST as $key => $value){
    if($url != ""){
        $url .= "&";
    }
    $url .= $key . "=" . $value;
}
echo "http://mysite.com/?$url";

 

Scott.

 

Wow thanks again for your help. Is it possible to MD5 or encrypt the $url which is finally outputted? I would prefer the variables not be publicly seen (ie viewing source etc) 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.