Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I convert parameters for a URL 1

Status
Not open for further replies.

towerbase

Programmer
Jul 31, 2002
1,053
GB
I'm sure this will have been asked before but I couldn't find it in the FAQs.

Is there a PHP function that will convert a string so it is suitable for a URL parameter?

For example, if a string contains "I like beer" then I want a function that will return "I+like+beer". The function will also have to cope with quotes and other special characters.

Andrew
Hampshire, UK
 
Yup.
$string = "I like beer";
urlencode($string);

To decode the url:
urldecode($string);

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top