note 5995 deleted from Array functions by ronabop
| From: | ronabop@php.net | Date: | Mon, 21 Aug 2000 09:50:26 +0000 |
| Subject: | note 5995 deleted from Array functions by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2861@lists.php.net to get a copy of this message | ||
How to get array values from a form without using []?
Professional PHP Programming, page 163, suggests that when you have text boxes with the same name,
put [] after them, eg:
<INPUT TYPE="text" NAME="oranges[]" VALUE=2>
<INPUT TYPE="text" NAME="oranges[]" VALUE=3>
When you submit the form, you can loop through your oranges to get each value.
However, this mucks up your javascript if you are accessing the value of each orange text box,
because when you put [] beside the NAME, javascript no longer recognizes those oranges as an array.
In perl, those oranges without the []would still be received as an array (12), which you can then
break apart and access element by element. Is this possible in PHP?