Spaces in GET[]

i have a form, and when I submit it, the URL changes to
&manufacturer=Guntermann & Drunck…
But when I

echo $_GET['manufacturer'}

I only get the first word, can I not assign the whole string to the variable?

Look up URL-encoding.

PHP: urlencode - Manual

If the space had worked, the & would have been the next thing to throw it out.

Slightly off topic, but if you are picking/selecting from existing choices, you should submit the id corresponding to the choice, not the actual name, because you should be using the id in any related operations.

2 Likes

(my money’s on the space actually having worked. Browsers will translate spaces to %20 readily enough, but an ampersand is a special character. I’d wager if OP looked closely, he’d find that he received the whole first word plus a trailing space.)

2 Likes