First, the $questions array:
Array
(
[2] => How much do you like cheese?
[3] => How much do you like cake?
[6] => Is this question successfully added?
)
Here’s how I’m trying to use it in the input:
<td>
<?php echo $this->Form->input('question', array(
'options' => $questions,
'selected' => $questions[6],
'name' => 'data[ResponseActions]['.$responseAction['responses_actions']['id'].'][question_id]'));
?>
</td>
However, whenever the page is rendered, element 2 is always selected by default. Does anyone know why I’m having this issue?
The
selectedoption expects the key, not the value.