[eluser]brucebat[/eluser]
Ok thanks:
Controller:
Code:
// This function displays the submit form for entering Interventional data to the database
public function displayform()
{
//Checks if a user is logged in, if they are not they get redirected -
if ( $this->session->userdata('name') == FALSE || $this->session->userdata('access_level') == FALSE)
{
redirect ('site/index');// to home page
}
//Loads table data that will be used to populate a pulldown
$page['formdata']=$this->submit_model->retrieve_values();
//This loads the form
$page['page'] = 'submit';
$this->load->view('template', $page );
return;
}
Model
Code:
// Retrieves values that will populate the form e.g. for pull downs etc.
function retrieve_values()
{
$query = $this->db->get('staff');
return $query;
}
View:
Code:
for ($i=0; $i < 5; $i++)
{
echo form_dropdown ('staff'.$i, $formdata, set_value ('staff'.$i));
}
I also tested the $formdata which came up with the options for the pulldown when I used a foreach and echoed the row, all the 13 rows where displayed in a line on my page.
Thanks