Jump to content

Help with $_GET function and URL with many vars


tqla

Recommended Posts

Here's how my url looks:

mailscript.php?url=http://www.mysite.com/ci/comparison.php?s1=ALABAMA&s2=ALASKA&s3=ARIZONA&s4=ARKANSAS&s5=COLORADO&s6=FLORIDA

 

When I use the $_GET['url'] function it only gets the url up to ALABAMA

http://www.mysite.com/ci/comparison.php?s1=ALABAMA

 

I need to get the entire url, all the way to florida in this case.

 

Any ideas how to do this? Thanks

Link to comment
Share on other sites

How are you generating the url. You need to use urlencode when you add http://www.mysite.com/ci/comparison.php?s1=ALABAMA&s2=ALASKA&s3=ARIZONA&s4=ARKANSAS&s5=COLORADO&s6=FLORIDA to your url. Eg

$refURL = 'http://www.mysite.com/ci/comparison.php?s1=ALABAMA&s2=ALASKA&s3=ARIZONA&s4=ARKANSAS&s5=COLORADO&s6=FLORIDA';

echo '<a href="mailscript.php?url='.urlencode($refURL).'">SOME LINK</a>';

 

In mailscript.php when you use $_GET['url'] you'll need to decode the url using urldecode. EG

$refURL = urldecode($_GET['url']);

echo $refURL;

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.