Welcome Guest, Not a member yet? Register   Sign In
form_dropdown remember values on page refresh

I have a form_dropdown that I'm using to sort data. How can I set the selected value to the most recent form selection

Should I use a session to store the data and pass that value? I'm trying to get it via post but it's not working.

Any ideas? Thanks!

  echo form_open('home');
  $options = array(
   'popular'   => 'Most Popular',
   'pricedown'  => 'Price: Low to High',
   'priceup'    => 'Price: High to Low',
   'date' => 'Date Ordered',

  $selected = ($this->input->post('sort')) ? $selected : $selected = 'popular';
  echo form_dropdown('sort', $options, $selected, 'onChange="this.form.submit();"');
  echo form_close();

Theme © iAndrew 2016 - Forum software by © MyBB