spod
spod

Reputation: 416

insert data into database from an embedded form in codeigniter

Hi I am using codeigniter and sheepIt clone forms.(embed forms).

I am trying to insert the data into database after submitting.

The output data is in this format when i used print_r()

Array
(
[project] => Array
    (
        [0] => Array
            (
                [module] => Design
                [features] => Array
                    (
                        [feature_0] => Array
                            (
                                [feature] => Login
                                [Hours] => 10
                            )

                        [feature_1] => Array
                            (
                                [feature] => Signup
                                [Hours] => 10
                            )

                    )

            )

        [1] => Array
            (
                [module] => Development
                [features] => Array
                    (
                        [feature_0] => Array
                            (
                                [feature] => Login
                                [Hours] => 20
                            )

                    )

            )

    )

[submit] => save
)

I can post the code of sheepIt forms also.

Upvotes: 0

Views: 687

Answers (1)

ShivarajRH
ShivarajRH

Reputation: 940

ANSWER:

$arr_data = $this->input->post();

foreach($arr_data['project'] as $prj) {
    foreach($prj as $i) {
        $arr['module'][] = module = $i['module'];
        foreach($i['features'] as $f) {
            $arr['feature'][] = $f['feature'];
            $arr['Hours'][] = $f['Hours'];
        }
    }
}
print_r($arr);

Use this processed $arr data for storing or other.

Upvotes: 1

Related Questions