如何在Cake php中通过隐藏类型添加数组?

I want to carry an array from one form to another form by hidden data type in cake php. I don't know how many number will come. So, I can not know how many number. e.g.

Example in PHP:

foreach($rNo as $no){
    echo "<input type='hidden' name='no[".$no."]' value='".$no."'>";
}

How do I translate this code to CakePHP $form->hidden()?

Serialize the array and store it.

For hidden input types you just use

$form->input('Model.field', array('type' => 'hidden'));

In your controller you just set the data eg $this->data['Model']['field'] = 'value';

For multiple fields you could loop through the $this->data array.

Your this->data would look like $this->data['Model'][0]['field'], $this->data['Model'][1]['field']

foreach($this->data['Model'] as $key => $data){
    $form->input('Model.'.$key.'.field', array('type' => 'hidden'));
}

It doesn't have to be $this->data, you could use any variable. But $this->data would automatically fill the input fields.

But you could just pass the value too if you wanted to. $form->input('Model.field', array('type' => 'hidden', 'value' => 'myvalue'));