Re: HTML id attribute and arrays
| From: | Jim Lucas | Date: | Sat, 18 Dec 2010 21:17:28 +0000 |
| Subject: | Re: HTML id attribute and arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310128@lists.php.net to get a copy of this message | ||
What are you trying to accomplish?
What do you think it wrong with the code below?
On 12/17/2010 8:19 AM, Martin C wrote:
Hi, PHP converts x[a]=b parameter of the HTTP request as an array named x with its item named a set to value b. So, it seems possible to have the following (X)HTML code: <input type="text" name="x[a]" id="x[a]" value="b" /> Unfortunatelly, HTML specification does not allow neither "[" nor "]" inside the id attribute. Specifically: * Must begin with a letter A-Z or a-z * Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".") * Values are case-sensitive How should I follow the HTML specification while having the passed parameters automatically converted to arrays in PHP? Thank you for any tips, Martin