0

I'm curious how to pass the value $name from the controller to the view success.php if $this->request->redirect ( 'success' ); is used. (it redirects to success.php if the name was entered on the previous page unless it stays on the same page).

View success.php contains:

Hello, <? echo $name; ?>!

Tried several ways to pass the value $name, but still have no luck. All the rest works fine (it redirects if the name is not empty). All I want is to write 'Hello, John', if 'John' was entered.

Thank you.

Haradzieniec
  • 9,086
  • 31
  • 117
  • 212

2 Answers2

3

Before the redirect set a session-variable with a key, like name:

$session->set('name', 'John');

After the redirect you call the variable with session->get_once();

$name = $session->get_once('name');
jannej
  • 864
  • 14
  • 26
2

It has nothing to do with Kohana but with basics of HTTP protocol.
This post describes several possible solutions for your problem.

Community
  • 1
  • 1
matino
  • 17,199
  • 8
  • 49
  • 58