How can use multiple select option with insert table joomla

$post = JRequest::get( ‘request’ );

// declare varible for insert table
$option_id= JRequest::getVar(‘option_id’, array(), ‘post’, ‘array’);
if (is_array( $barring_id)) {
$post[‘option_id’] = implode( “,”, $option_id);
}

$db =& JFactory::getDBO();
$query = ‘SELECT * FROM #__test_option’;
$db->setQuery( $query );
$list[] = JHTML::_(‘select.option’, ‘0’, JText::_( ‘Select Type’ ), ‘option_id’, ‘type’ );
$list2 = array_merge( $barringlist,$db->loadObjectList() );
$lists[‘id’] = JHTML::_(‘select.genericlist’, $list2, ‘option_id[]’, ‘class=”inputbox” multiple=”multiple” ‘,’option_id’, ‘type’, explode(‘,’, $data->option_id ));

use explode so that when edit form than it display selected option.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s