tqla Posted March 9, 2010 Share Posted March 9, 2010 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 https://forums.phpfreaks.com/topic/194657-help-with-_get-function-and-url-with-many-vars/ Share on other sites More sharing options...
schilly Posted March 9, 2010 Share Posted March 9, 2010 you will need to encode the "&" signs. mailscript thinks it's a separate variable. print_r($_GET); on mailscript.php and you'll see what I'm talking about. Link to comment https://forums.phpfreaks.com/topic/194657-help-with-_get-function-and-url-with-many-vars/#findComment-1023743 Share on other sites More sharing options...
wildteen88 Posted March 9, 2010 Share Posted March 9, 2010 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 https://forums.phpfreaks.com/topic/194657-help-with-_get-function-and-url-with-many-vars/#findComment-1023744 Share on other sites More sharing options...
tqla Posted March 9, 2010 Author Share Posted March 9, 2010 Perfect! Thanks shilly and WT88. urlencode() worked like a charm! Link to comment https://forums.phpfreaks.com/topic/194657-help-with-_get-function-and-url-with-many-vars/#findComment-1023746 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.