jeudi 7 décembre 2017

Multiple checkbox array cakephp 3

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

Here's how I code 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. I just shows "Array()". Can anyone help me?




Aucun commentaire:

Enregistrer un commentaire