php - Codeigniter: Fetch the value from an option in the dropdown list and check SQL condition -


i having issue fetching values dropdown list check condition mysql query. using codeigniter. let me post code have included below:

view:

<select name="month" id="month">         <option>select month</option>         <option value="01">january</option>         <option value="02">february</option>         <option value="03">march</option>         <option value="04">april</option>         <option value="05">may</option>         <option value="06">june</option>         <option value="07">july</option>         <option value="08">august</option>         <option value="09">september</option>         <option value="10">october</option>         <option value="11">november</option>         <option value="12">december</option>     </select> 

the above values should equal month in date column of table. post model below:

model:

$month = $this->input->post('month');     $this->datatables->select('order_no,order_date,naturescrm_customers.name,total,naturescrm_users.username,naturescrm_order.id,         naturescrm_order_status.status_name')         ->unset_column('naturescrm_order.id')         ->add_column('actions', btn_edit('agent/order/edit/' . '$1').' '.get_view('$1','agent/order/view/') ,'naturescrm_order.id')         ->from($this->_table_name)         ->join("naturescrm_customers","naturescrm_customers.id=naturescrm_order.customer_id","left")         ->join("naturescrm_order_status","naturescrm_order_status.status_id=naturescrm_order.order_status","left")         ->join("naturescrm_users","naturescrm_users.id=naturescrm_order.user_id","left")         ->where("date_format(order_date, '%m') = $month");         $this->db->order_by("order_date","desc"); 

there code in model , in view, when select month in dropdown, values being fetched in database should reflect based on month. appreciated. thanks


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -