Need valid XHTML

SpaceshipSpaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Hey. Firstly, I need pages on my webiste to contain the following link:

go.php?id=5&url=http://www.newdomain.com

however, it's not valid XHTML. So I've encoded it (which looks horrible and I rather I hadn't but I feel its the only way). And now I cannot decode it. I've used urldecode but it still shows:

go.php?id%3D5%26url%3Dhttp%3A%2F%2Fwww.newdomain.com

I tried:

PHP:
urldecode($_GET['$url']);

// ...and...

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

...but it doesn't work. What would be absaloutley perfect would be something like:

go.php/5/http://www.domain.com

where 5 is the id and http://www.domain.com is the domain.

Thanks
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
1. Make sure you have used urlencode() to generate the link
2. Make sure that the name of the parameter in the URL is the same for both pages
3. In the target page you need something like this to fetch the parameter from the URL:
$url=urldecode($_GET['url']);

'url' is a litteral name, remove the $ sign and I guess you should be fine
Please note that $_GET['url'] and $url are two different variables actually, here I'm assigning the value of $_GET['url'] to $url in PHP code


To generate SEO-friendly URLs like go.php/5/http://www.domain.com you could simply used mod_rewrite for automatic URL rewriting so you don't have to handle this in your code...
 
0
•••
Thanks sdsinc
 
0
•••
A bit offtopic byt why do you use "http://" in the query string? Seems like a waste of 7 bytes :)
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back