RE: [PHP] Add to array problem
| From: | Murray @ PlanetThoughtful | Date: | Mon, 16 May 2005 15:39:31 +0000 |
| Subject: | RE: [PHP] Add to array problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215302@lists.php.net to get a copy of this message | ||
> I'm having a little problem adding to an array. Each time I add to an
> array it wipes what was previously added. I'm using array_push().
>
> $items=array();
> $items=array_push($items, $_POST["whatever"]);
>
> I'm missing something easy.
Try:
$items=array();
array_push($items, $_POST["whatever"]);
In other words, remove the "$items=" in front of "array_push(...."
Regards,
Murray