Last Updated: 09 May 2008
PHP allows you to name multiple form elements with the same name (appended by square brackets):
<form name='myForm'> <input type='text' name='myInput' id='myInput' /> <input type='text' name='myInput' id='myInput' /> <input type='text' name='myInput' id='myInput' /> </form>
When you submit this, the
0th element of the
myInput array, which doesn't exist.) Instead, you can use the array notation for accessing a property of an object:
myInput is now being passed in as a string, and not a JS identifier, you're fine.