Welcome Guest, Not a member yet? Register   Sign In
Handle $_POST[ ][ ] arrays
#1

[eluser]Unknown[/eluser]
Hi there,

I know this has been discussed earlier.
Even though this code is working, I´m sure that this is not the best solution - am I right?

Controller:
Code:
$count = 3
    function save()
    {
        for ($i=0; $i < $count; $i++)
        {
            $persons = array
            (
                'Firstname'  => $_POST['Firstname'][$i],
                'Lastname'   => $_POST['Lastname'][$i],
                'Gender'     => $_POST['Gender'][$i]
            );
            $this->personModel->save($persons);
        }
    }

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB