Posted by Jason Barnett on 05/16/05 18:18
Mayo wrote:
> 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.
>
> thx
>
>
<?php
$items[] = sanitize($_POST['whatever']);
function sanitize($postdata) {
/* Some function that will check this $_POST data. In this case
we'll just return the original value i.e. do no data validation. */
return $postdata;
}
?>
Navigation:
[Reply to this message]
|