[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-30-2006, 02:13 PM   #1 (permalink)
SQLdumpster.com
 
miseria's Avatar
 
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 545
205.50 NP$ (Donate)

miseria will become famous soon enoughmiseria will become famous soon enough


Need valid XHTML

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.c om

I tried:

PHP Code:
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
__________________
!!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!!
Free Databases for your Website | All Things Playstation 3
Website Design Books | Music While You Work? | Computer Gadgets

Last edited by miseria; 03-30-2006 at 02:19 PM.
miseria is offline  
Old 03-30-2006, 02:50 PM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
 
Join Date: Aug 2005
Location: Web 1.0
Posts: 6,285
1,095.94 NP$ (Donate)

sdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond repute

Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer
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...
__________________
Buy now - MassDeveloper.com $500
sdsinc is offline  
Old 03-30-2006, 03:00 PM   #3 (permalink)
SQLdumpster.com
 
miseria's Avatar
 
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 545
205.50 NP$ (Donate)

miseria will become famous soon enoughmiseria will become famous soon enough


Thanks sdsinc
__________________
!!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!!
Free Databases for your Website | All Things Playstation 3
Website Design Books | Music While You Work? | Computer Gadgets
miseria is offline  
Old 04-01-2006, 02:17 AM   #4 (permalink)
mch
NamePros Regular
 
Join Date: Nov 2005
Location: EU
Posts: 248
99.25 NP$ (Donate)

mch is on a distinguished road


A bit offtopic byt why do you use "http://" in the query string? Seems like a waste of 7 bytes
mch is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:15 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85