列表框-html名称中的空格

I have an html file with code for a form

<select name="listbox" size="3">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

I am using the values in a php script. If I rename 'listbox' to 'list box' it does not work in any browser. I take it it's because of the white space, right? Are white spaces in names not allowed in html? Thank you for any help.

Read the specification at http://www.w3.org/TR/html401/types.html#type-name

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

Try this HTML. Both Mozilla Firefox and IE are fine with it!

<html>
<head>
 <title>Name Attribute with Spaces</title>
</head>
<body>
<form method="get"> <!-- no "action", form will post to self -->
 <table>
   <thead><b>Please provide login details</b></thead>
   <tbody>
    <tr>
        <td>Username:</td>
        <td><input type="text" name="user name" /></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input type="password" name="pass word" /></td>
    </tr>
    <tr>
        <td>List Box:</td>
        <td>
            <select name="123 list box" size="3">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
        </td>
    </tr>
        <tr>
        <td colspan="2"><input type="submit" value="Login" /></td>
    </tr>
   </tbody>
  </table>
</form>
</body>
</html>

The reason HTML doesn't have any problems with spaces is URL Encoding. If you test the above form you'll find the browsers automatically encode special characters and hence a space " " gets converted to a "+" (or, sometimes "%20").

test.html?user+name=ravi&pass+word=canuseeme&123+list+box=2

The reason why PHP seems to run into trouble here (from what I vaguely remember) is that it tries to expose request parameters as easily accessible variables to the PHP programmer. And variable names in any language do not contain spaces or start with numbers.

Edit: In fact, if you make multiple selections true for your select box (just add multiple attribute in select) the name needs to end in "[]" to give PHP a hint that it needs to arrange for an Array variable!