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
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) 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.