Page 1 of 1

URL Encode equivilant

Posted: Tue Apr 01, 2003 2:58 pm
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

Posted: Tue Apr 01, 2003 4:17 pm
by Rob the R

Posted: Tue Apr 01, 2003 4:48 pm
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?

Posted: Wed Apr 02, 2003 2:05 am
by twigletmac
Use urlencode() - AFAIK there is no url_encode() function.

Mac