dimanche 10 décembre 2017

Checkbox cannot stored data CakePHP 3.5

I've looked all of the examples about checkbox array using cakephp 3.5. However, I didnt find any example that can solve my problems. I want to create checkbox array which will get the id. However, the checkbox cannot stored the data.

Here's the coding of the checkbox

<?php echo $this->Form->create($question) ?>   
<?php foreach ($questions as $question): ?>
<tr>
    <td><?= $this->Form->checkbox('id', array('value' => $question['id'], 'name' => '[Question][id]['.$question['id'].']', 'checked'=>false)) ?></td>
    <td><?= $this->Number->format($question->id) ?></td>
    <td><?= h($question->question) ?></td>
    <td><?= $this->Number->format($question->marks) ?></td>
</tr>
<?php endforeach; ?>

When I tried to print_r, the array didn't submit any data. That means when I click save, the data is not stored. It just shows "Array()". Can anyone help me?




Aucun commentaire:

Enregistrer un commentaire