[eluser]IbnKhnata[/eluser]
Hello
I am a codeigniter newb and is trying to create a search function for my website where people could either search by entering keywords, or by selecting a year or publication type or author name from different drop down boxes( the whole thing should be database driven off course.
I am having trouble with my last dropdown box(authors), I can't get it do display the first and last name of the authors without having an undefined Index First_Name to be diplayed inside the combo box.
Some help would be greatly appreciated
Thanks
here what I have so far
Controller
function search()
{
$keywords = trim($this->input->post('search_string'));
$yr = trim($this->input->post('Year'));
$type = trim($this->input->post('Type'));
$author = trim($this->input->post('Authors'));
$search_items = array('keywords' =>$keywords,'yr'=>$yr);
$this->load->model('publications_model');
$data['Year'] = $this->publications_model->get_Year_dropdown();
$data['Type'] = $this->publications_model->get_Type_dropdown();
$data['Authors'] = $this->publications_model->get_Authors_dropdown();
$data['publications'] = $this->publications_model->getTableResults($search_items);
$this->load->view ('publication_view',$data);
}
Model
function get_Authors_dropdown() {
$this->db->select('StaffID','Last_Name','First_Name');
$this->db->order_by('Last_Name', 'asc');
$query=$this->db->get('tbl_staff');
$author_result = $query->result_array();
return ($author_result);
}
View ( partial code)
<select name ="Authors" />
<option value="all">- By Authors-</option>
<?php foreach ($Authors as $key => $items){ ?>
<option value="<?=$items['First_Name'] . ' '. $items['Last_Name']?>"<?php echo set_select('Authors',$items['First_Name'] . ' '. $items['Last_Name']);?>><?=$items['First_Name'] . ' ' . $items['Last_Name']?></option>
<?php } ?>
</select>