I'm using CakePHP 2.3.1.
I need to know if there's the possibility to fill a $variable in a form field. and if (exists) how should I do it?
As you can see in my event_repeat() function.
function repeat($id = null) {
if (!$id) {
$this->Session->setFlash(__('Prenotazione non trovata'));
$this->redirect(array('action' => 'view', $this->data['Event']['id']));
}
//this is the variable I need
$repeat = $this->data['Event']['repeat'];
$i = 1;
do {
//code
} while ($repeat > $i);
}
the $repeat variable, is the number of repeats the user wants, and I want it to be set by an input form as a positive integer value.
How can I make an input field refer to a variable inside the controller, instead of a database field?
$this->Form->input('repeat', array('label' => 'How many times you wish to repeat?'));- Stefano Minin