Hi, I created a listbox but it doesn’t allow me to select multiple from the options provided inside the box by pressing “CTRL” + “clicking the desired options”
that multiselect list box is located at the top my form for creating a product
so that the user can choose one or more categories for the certain product to be created,
how will I fetch the value/values of one or multiselected options from the listbox and get it saved to it’s corresponding table ?
my products table has these columns
ProductID, ProductDescription
my category_products table has these columns
catid, ProductID
this table above should save the integer value of the selected option from the lisbox
my create action has this code
public function actionCreate()
{
$model=new Wswebproducts;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Wswebproducts']))
{
$model->attributes=$_POST['Wswebproducts'];
if($model->save())
$this->redirect(array('view','id'=>$model->ProductID));
}
$this->render('create',array(
'model'=>$model,
));
}
how to get the multi selected values from my form and save it along with the product ?
if I created 1 product and it has catid 1,2,3,4,5 …how will i do that?