I have a form.
After submitting this form i want to save the data for multiple times in DB.
Is it possible or not.
If yes then how?
I am facing problem.
I have a form.
After submitting this form i want to save the data for multiple times in DB.
Is it possible or not.
If yes then how?
I am facing problem.
If you want to save data multiple times in one table, you can do something like:
//In your model. It can be beforeSave() or afterSave() - as you wish:
public function afterSave(){
$model = new self( $this->scenario );
$model->attributes = $this->attributes;
if ( self::$stopSaving!==true ) {
self::$stopSaving = false; //or another condition to avoid infinite loop
$this->save();
}
else return true;
}
public static $stopSaving; //indicator whether to continue saving new models or not
Thanks for quick reply.
I want to be more specific.
I want to continue loop to the value of a variable which is in the form.
So then…