note 29659 added to language.variables.predefined
| From: | myerswst at cps dot k12 dot va dot us | Date: | Thu, 20 Feb 2003 17:56:15 +0000 |
| Subject: | note 29659 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44265@lists.php.net to get a copy of this message | ||
This is in addition to pschulten at NOSPMweb dot de and slandau at miticom dot com.
If you need to access $_POST variables where the form element names were duplicated such as
<input type='text' name='my_field'>
<input type='text' name='my_field'>
<input type='text' name='my_field'>
you do need to rename to
<input type='text' name='my_field[]'>
<input type='text' name='my_field[]'>
<input type='text' name='my_field[]'>
when you do that, you can access them like this
$_POST[my_field][0]
$_POST[my_field][1]
$_POST[my_field][2]
however, and if you know a way around this please help,
you can no longer process these form elements as an array using JavaScript
For example:
for(var i = 0; i < 3; i++)
{
document.form_name.my_field[i].value = 'whatever';
}
you will get an error saying
document.form_name.my_field has no properties
or at least I got that error
Any suggestions?
--
http://www.php.net/manual/en/language.variables.predefined.php
http://master.php.net/manage/user-notes.php?action=edit+29659
http://master.php.net/manage/user-notes.php?action=delete+29659
http://master.php.net/manage/user-notes.php?action=reject+29659