I am Learning so

Can suggest some code.

How can i add Multi select Box in Codeigniter.

Thank You

Recommended Answers

Taken from http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html

$this->load->helper('form');

$options = array(
    'small'  => 'Small Shirt',
    'med'    => 'Medium Shirt',
    'large'   => 'Large Shirt',
    'xlarge' => 'Extra Large Shirt',            
);

echo form_multiselect('shirts[]', $options, $shirts_on_sale);
Jump to Post

All 3 Replies

then how to get value in controller..
like this: $this->input->post('shirt')??

$shirts = $this->input->post('shirt');

foreach($shirts as $shirt){
    echo $shirt;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.