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

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;

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.