PHP - MYSQL - Passing a text variable via $_GET that has & in it?

stephenmp used Ask the Experts™
Ok...  simple question I hope!

I'm passing a variable thru $_GET... The variable is a dynamic variable being pulled from MYSQL...  So when a user wants to edit an item they click edit and I pass the data via GET...  Let's say they click an item and it passes "Southern & Soul"...  The url looks like this:  manage_listing_forms.php?action=edit_choice&choice_id=258&choice=Southern%20&%20Soul&sort_order=54&question_id=15

However, when I print that value in an editable form, it only shows "Southern" ...  everything after the & is gone???

I know this is something simple...  If I have to, I'll place this in SESSION, but I thought there may be an easy work around...   If there is a work around...  Are there any other characters or problems i might run into when passing this data via get???
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
when you generate your url, pass the variable through urlencode:

....e&choice_id=258&choice=".urlencode ( $varfromdb )."&sort_roder=.......

Note it will replace the & in the name with %26 in your case.


Thanks so much...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial