URL Encode equivilant

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
john_crawford32
Forum Newbie
Posts: 9
Joined: Mon Mar 31, 2003 7:56 pm
Location: East Berlin, PA
Contact:

URL Encode equivilant

Post by john_crawford32 »

I am pulling information from a database like
"Bed and Breakfasts" and put it in a link for an a href.

Code: Select all

$link = "default.php?content=category&section=".htmlspecialchars (stripslashes($rowї"Category"]))."&letter=~";
What I am looking for is the string to be encoded like this

Bed%20and%20Breakfasts

but I am not getting that so it ends up with spaces left in.
Again an ex coldfusion guy, we had a command urlencode that would do this.
I thought htmlspecialchars() would do this but it doesn't.
Is there a function I am missing or do I need to do this manually?
Thanks
John
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post by Rob the R »

john_crawford32
Forum Newbie
Posts: 9
Joined: Mon Mar 31, 2003 7:56 pm
Location: East Berlin, PA
Contact:

Post by john_crawford32 »

Thanks Man,
I need to get a better book,
I have 3 couldn't find it.
Now that you pointed me in the right direction I see url_encode and urlencode. What is the difference?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Use urlencode() - AFAIK there is no url_encode() function.

Mac
Post Reply