database - How to post the data of chosen item in dropdown into a table -


how put information of selected item in dropdown list table if choose "chris" dropdown of details of chris on database post in table? make this:

select customer:dropdownlist choose 1 dropdown after select 1 there table below display further details of 1 have chosen

firstname| lastname| address

chris | chris | california

controller

 public function salesorders() {         if ($this->session->userdata('logged_in')) {             $this->header2();             $data['groups'] = $this->secretary_model->getallgroups();             $this->load->view('secretary/transactions',$data);         } else {             redirect('secretary/sec_login_view');         }     } 

model

function getallgroups()     {          $query = $this->db->query('select firstname tblcustomer');          return $query->result();      } 

view

<?php              echo "select customer";             $options = array();             foreach($groups $group)             {                $options[$group->firstname] = $group->firstname;             }             echo form_dropdown('dropdown', $options);             ?>             <br>             <br>             <br>                     <table id="mytable" class="table table-bordered" >                           <thead >                               <tr>                                    <th>order #</th>                                   <th>customer name </th>                                   <th>items</th>                                   <th>note</th>                                   <th>qtt.</th>                                  <th>total price</th>                                  <th>shipping address</th>                                  <th>status</th>                                   <th>edit</th>                                </tr>                           </thead>                           <tbody>   

you can try well. use , working fine

<ul>     <?php             foreach($groups $group)         {             ?>             <li value="<?php echo $group['id']; ?>"><?php echo $group['firstname']; ?></li>         <?php             }     ?> </ul> 

in model change this $query = $this->db->query('select firstname tblcustomer'); to this $query = $this->db->query('select * tblcustomer');


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -