I'm new to PHP and Yii framework. how to insert multiple questions in database
This is Form view code
<?php echo $form->textField($model,'questions',array('id'=>"content_#index#_question textBox")); ?>
<?php echo $form->textField($model,'questions',array('id'=>"content_#index#_question textBox")); ?>
Here is My Controller
public function actionAdd_quick()
{
$model=new Question;
$answers=new Answers;
if(isset($_POST['Question'],$_POST['Answers']))
{
$model->attributes=$_POST['Question'];
$answers->attributes=$_POST['Answers'];
foreach ($model['questions'] as $value) {
$model->questions = $value;
}
$model->save();
Yii::app()->user->setFlash('add_quick','Thank you for ');
$this->refresh();
}
$this->render('add_quick',array('model'=>$model,'answers'=>$answers));
}
actually my process is to create multiple questions and answers ,but now getting error like
"Invalid argument supplied for foreach()" by using my code and how to send multiple questions and answers to mysql tables...