Hi all.
How do I stop execution after a render call or is my logic wrong?
This is what I have:
if(isset($_POST['myform']))
{
if($model->save())
{
if(true)
{
$this->render('create',array('model'=>$model,));
}
}
}
$this->render('create',array('model'=>$model,));
So what happens is this:
-
First call to the page a POST of the form is not set, so it will jump to the last render call.
-
When I submit the form, it will go into the 1st if, then into the second if(model->save) and then into the 3rd if(true) and then call the render inside the 3rd if.
But that is not where it stops, the code will execute further outside all the if’s and render the page again. So now I have the same page content duplicated on a single browser page. It was my understanding that a render will happen and none of the code below it will execute. I was wrong(I think).
So please, how do I prevent it from doing it? Or do I need to put everything in multiple if statements?
Thanks