Welcome Guest, Not a member yet? Register   Sign In
How to repopulate update form and radio inputs
#1

[eluser]benners[/eluser]
Can someone please point me in the right direction to re-populate the radio buttons on an update form. I think I need to utilize form validation but I've not been able to find enough information on this.

Controller: Quiz
Code:
function update_test($comp_img)
{
$quiz_data =  $this->quiz_model->get_quiz_data($comp_img);
$data['quiz'] = $quiz_data;
$data['main_content'] = 'quiz_edit';
$this->load->view('includes/template', $data);
}



View: quiz_edit.php
Code:
echo form_open('quiz/save');
$x = 1;
foreach ($quiz as $file_item):
$data = array(
    'name'        => $x.'[correct_answer]',
    'value'       => set_radio($x.'[correct_answer]', $file_item['correct_answer']),
  );
$data2 = array(
    'name'        => $x.'[correct_answer]',
    'value'       => set_radio($x.'[correct_answer]', $file_item['correct_answer']),
  );
echo 'A:'.form_radio($data);
echo 'B:'.form_radio($data2);
$x = $x + 1;
endforeach;


Messages In This Thread
How to repopulate update form and radio inputs - by El Forum - 03-02-2012, 06:29 AM
How to repopulate update form and radio inputs - by El Forum - 03-02-2012, 01:01 PM
How to repopulate update form and radio inputs - by El Forum - 03-02-2012, 01:42 PM
How to repopulate update form and radio inputs - by El Forum - 03-02-2012, 01:47 PM
How to repopulate update form and radio inputs - by El Forum - 03-02-2012, 02:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB