Slug: form-handling-in-php Date: 2004-07-23 Title: Form handling in PHP layout: post
I found out a cool feature of PHP today. I'm sure that every other PHP hacker on the planet already knows this, but I didn't ;-).
If you have several form elements that all pertain to a single entity, you can write your HTML like this:
<input name="entity[property]" value="$val" />
and PHP will create an associative array in the
$_GET data with the name
entity and a key
property with value
P.S. I did find a pointer to this page on Variables from Outside PHP that sort-of explains it, but it doesn't really address the associative-array feature.