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
  • 8,592
  • 29
  • 109
  • 204

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
  • 822
  • 13
  • 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
  • 16,442
  • 7
  • 46
  • 56