Jump to content

Passing URL as variable by GET method


akshay

Recommended Posts

Hello.

 

I was just wondering how to pass a URL as a variable with $_GET method. For example a redirect page...

 

Example:

$url="http://yoursite.web/ref/?id=2948&name=jon&abc=xyz"

$code="12345"

 

Now when I link the two variables , the resulting link might look like :

 

http://mysite.web/redirect.php?code=12345&url=http://yoursite.web/ref/?id=2948&name=jon&abc=xyz

 

or, ?url=......&code=...

 

The problem is that the "&" and "?" might interfere with each other and may deliver no result on the page.

 

I think the solution is converting the special characters into HTML, what do you say, encryptions?

 

Like " " (space) = %20

and "/" (slash) is %2F or %3F

 

How to do so? Any other solution welcome.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/199910-passing-url-as-variable-by-get-method/
Share on other sites

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.