I have a action
which i am calling
it two time
Controller.php
UserController extends Controller {
public actionCopy($id = false){
if($id){
//redireting to a view
}
else{
//rediredtion to a differnet view
}
}
}
I am getting a id
first then from first view
i am again coming to Copy action
with no id so else part is running nw but in this i want to get the $id
which i get from first request.
I have tried to define a global variable in controller like
Controller.php
UserController extends Controller {
public $user;
public actionCopy($id= false){
if($id){
$this->user = $id;
//redireting to a view
}
else{
echo $this->user ;// but it has nothing
//rediredtion to a differnet view
}
}
}
and set it like this.
I know that if condition
is not executing so $id
has no value but i set $this->user
first time then why it has no value
.
Any help is appreaciated