7

I get an int value to the controller and I would like to send it to the according view, but i am either passing or accesing it wrong. Here is what I am trying to do:

Controller:

function send($int = NULL) {
    $this->set('integer', $int);

}

View:

echo $integer['int']

Your help is much appreciated!

Johhny P
  • 163
  • 1
  • 2
  • 9

1 Answers1

13

Change

echo $integer['int']

To:

echo $integer;

The first parameter in $this->set is used as the variable name in your view, the second parameter is the value assigned to that variable.

cowls
  • 24,013
  • 8
  • 48
  • 78