PHP URL Encoding Question

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

paintitblack
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Feb 17, 2014 8:53 pm

PHP URL Encoding Question

Postby paintitblack » Mon Feb 17, 2014 8:56 pm

I need to convert this:

Code: Select all

/page-name/?q=search+term


to this for use in an HTML form field:

Code: Select all

/page-name/?q=search&#043term


However, I can't find which PHP function does this particular conversion/encoding.

Any ideas?

Thanks!

User avatar
macek
php-forum Active User
php-forum Active User
Posts: 277
Joined: Wed Aug 25, 2010 10:42 am
Contact:

Re: PHP URL Encoding Question

Postby macek » Mon Feb 17, 2014 11:36 pm


paintitblack
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Feb 17, 2014 8:53 pm

Re: PHP URL Encoding Question

Postby paintitblack » Tue Feb 18, 2014 3:16 pm

Thanks, but I'm still not seeing an option to generate the format I need.

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: PHP URL Encoding Question

Postby seandisanti » Thu Feb 27, 2014 10:18 am

That is the name of the function....htmlentities($_SERVER['REQUEST_URI']) is exactly what you're looking for.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

cron