RE: [PHP] getting an array out of the POST array
| From: | Ian M. Evans | Date: | Tue, 17 Aug 2004 22:21:18 +0000 |
| Subject: | RE: [PHP] getting an array out of the POST array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194099@lists.php.net to get a copy of this message | ||
Thanks, that worked.
So I understand this better did this
($_POST[firstname][$key] = trim($_POST[firstname][$key]);)
not work because the variable to the left of the '=' was no longer POSTed?
---- Original Message ----
Remove $_POST from $_POST[firstname][$key], $_POST[middlename][$key] and
$_POST[lastname][$key].
It should simply be $firstname[$key], $middlename[$key], and $lastname[$key]
Not sure what your array data looks like but instead of using while() use
foreach():
foreach($_POST['firstname'] as $key => $value){
$firstname[$key] = trim($_POST[firstname][$key]);
$middlename[$key] = trim($_POST[middlename][$key]);
$lastname[$key] = trim($_POST[lastname][$key]);
}