[eluser]john36122340[/eluser]
Hi everyone,
I was wondering why this code does not work, I thought if I set a property of the class and then redirected to another method in that class the property would still be available in another method.
Does anyone have any ideas?
Is it possible without flashdata?
Thanks,
John
Code:
function method_one()
{
$this->some_var = 'Susan';
redirect( '/welcome/method_two' );
printf('<p>This is the first printf from method_one</p>');
}
function method_two()
{
printf('<p>This is the first printf from method_two</p>');
printf('<p>This is the value of some_var "%s" set in method_one</p>', $this->some_var);
$this->some_var = 'Bill';
printf('<p>This is the value of some_var "%s" set in method_two</p>', $this->some_var);
}
Outputs:
Code:
This is the first printf from method_two
This is the value of some_var "" set in method_one //Why is $this->some_var = 'Susan' not available here?
This is the value of some_var "Bill" set in method_one