Select tag reload and submit


<!-- script -->
<script>

// ********************************************************
// *     Supplier select with pagination                    *
// ******************************************************** 
    $("#supplier").change(function () {
    $("#supplierallid").submit();
    });


</script>

<!-- VIEW   -->
<form action="<?php echo base_url("ordercontroller/purchaseorder")?>" id="supplierallid" method="get">
    <div class="form-group">
        <label for="allsupplier" style="font-size: 14px;font-weight: 600; color: #00bcd4;">Select Supplier</label>
        <select class="form-control" name="supplier_id" id="supplier" >
            <option value="">All Supplier</option>
            <?php foreach ($allsupplier as $val) {?>
                <option <?php if($supplierid==$val->idecho 'selected="selected"'?> value="<?php  echo $val->id?>"><?php echo $val->contact_Name?></option>
            <?php   } ?> 
        </select>
    </div>
</form>


<!-- model   -->

<?php
  // allsupplierproduct
  function allsupplierproduct(){
   
    $supplierid=  $this->input->get('supplier_id');
      $this->db->select('*');
      $this->db->order_by('id',"desc");
      $this->db->from('supplier_product');

      if(!empty($supplierid)){
          $this->db->where('supplier_id',$supplierid);
      }

      $allsupplierproduct=$this->db->get();
      return    $allsupplierproduct->result();
  }
?>


Comments

Popular posts from this blog

date wise search codeigniter

all customer due sql query