Welcome Guest, Not a member yet? Register   Sign In
Question with isset on a search function?
#1

[eluser]Solarpitch[/eluser]
Hey Guys,

I have the following controller for doing a simple search on the site. Initially I take the search term as a post from the form and then the results are generated.

The user then has an option to select if they would like to view the results in a grid or list style, so the search term needs to be resubmitted to the function through the URI so the function can generate the results in the appropriate style.

Code:
function search()
{

$this->load->view('template/header');

// Get the search term from the submitted form        
$term = $this->input->post('term');


// This will get the style for the list, either "grid" or "list". This is for after
// the user has searched and then wishes to choose a style to display the results.

$list_style = $this->uri->segment(4);
                
$data['query'] = $this->product_model->search_keyword($term);
    

if($list_style == "grid"){
$this->load->view('pages/phones_grid', $data);
}
else
{
$this->load->view('pages/phones_list', $data);
}

//$this->load->view('template/footer');
}


Is there anyway I can say, if form is not being submitted then set term equal to uri->segment(4) instead of input->post('term')


Messages In This Thread
Question with isset on a search function? - by El Forum - 01-14-2009, 04:36 PM
Question with isset on a search function? - by El Forum - 01-14-2009, 06:07 PM
Question with isset on a search function? - by El Forum - 01-15-2009, 05:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB