0

I have multiple checkboxes in my view as

<input type='checkbox' name='seats[]' value='$rowId$columnId'>

These are submitted to the controller and stored in a session

 $data['seats']=$this->input->post("seats");
$this->session->set_userdata($data);

Now how can I retrieve all the checked values one by one in my model.I want to store every checked value as a record in the database.

1
  • if you have found a solution, you should accept the answer or delete question to avoid further vote down Commented Jan 22, 2014 at 2:06

2 Answers 2

2

What you have to do is

$array=$this->session->userdata('seats');

I would sugggest you to look at userguide carefully before putting up a questoin

Sign up to request clarification or add additional context in comments.

2 Comments

I've checked the userguide.But how can I retrieve each value of this array?Would I need a foreach loop?
Yes of course. wherever you have doubt about array use print_r($array) to print it and run for loop accordingly
0

You can set session data,

$this->session->set_userdata('Key','Value');

You can retrieve session data,

$this->session->userdata('Key');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.