phphtmlformshtml-input

Characters allowed for name attribute of input element?


I have a PHP script that will generate <input>s dynamically, so I was wondering if I needed to filter any characters in the name attribute.

I know that the name has to start with a letter, but I don't know any other rules. I figure square brackets must be allowed, since PHP uses these to create arrays from form data. How about parentheses? Spaces?


Solution

  • The only real restriction on what characters can appear in form control names is when a form is submitted with GET

    "The "get" method restricts form data set values to ASCII characters." reference

    There's a good thread on it here.