Note that there are some explanatory texts on larger screens.

plurals
  1. POcodeigniter pagination with selected records
    primarykey
    data
    text
    <p>I am new with codeigniter. Hope can help to solve problem on codeigniter pagination.</p> <ol> <li>i have selected some records from my view and pass to my controller using $_POST. </li> <li>the controller will use $_POST variable to select records from a model. </li> <li>then records will be display in the same view with pagination.</li> </ol> <p>step 1-3 is okey, the view display correct info. </p> <ol> <li>when press on the pagination button from my view. This will call the same controller but $_POST info be come blank. So, my view is not displaying with the selected records as needed.</li> </ol> <p>hope can help out.</p> <p>i have simplied the code as follows:-</p> <p><strong>controllers:</strong></p> <pre><code> $config['total_rows']=$this-&gt;invdata_model-&gt;getFilterData_numRows(); $config['base_url']=site_url('site/users_area') ; $config['uri_segment'] = '3'; $config['per_page']=18; $config['num_links']=4; $this-&gt;pagination-&gt;initialize($config); $data['records']=$this-&gt;invdata_model-&gt;getFilterData_Rows($config['per_page'],$this-&gt;uri-&gt;segment(3)); $data['rec_country']=$this-&gt;invdata_model-&gt;country(); $this-&gt;load-&gt;view('includes/header'); $this-&gt;load-&gt;view('users_area_view',$data); $this-&gt;load-&gt;view('includes/footer'); </code></pre> <p><strong>models:</strong></p> <pre><code> $country = $this-&gt;input-&gt;post('country') ; $this-&gt;db-&gt;select('stockno, bdlno, country,volton'); if (isset($country)) { $this-&gt;db-&gt;where_in('country',$country); } $q=$this-&gt;db-&gt;get('inventory')-&gt;num_rows(); return $q ; </code></pre> <p><strong>View</strong></p> <pre><code> &lt;?php echo form_open('site/users_area'); echo $this-&gt;table-&gt;generate($records); echo $this-&gt;pagination-&gt;create_links() ; ?&gt; &lt;div class="gadget"&gt; &lt;?php echo form_submit('submit','Apply','class="button_form"'); ?&gt; &lt;/div&gt; $gadget['gadget_name']='country'; $gadget['gadget_rec']=$rec_country; $this-&gt;load-&gt;view('gadget',$gadget); &lt;/form&gt; </code></pre> <p><strong>View Gadget</strong> </p> <pre><code> &lt;div class="gadget"&gt; &lt;?php $gadget_name2=$gadget_name.'[]'; echo "&lt;ul&gt;"; foreach ($gadget_rec as $item) { echo '&lt;li &gt;'; echo '&lt;div id="sectionname"&gt;'.$item.'&lt;/div&gt;'; echo '&lt;div id="sectioninput"&gt;&lt;input type="checkbox" name="'.$gadget_name2.'" value="'.$item.'"&gt;&lt;/div&gt;' ; echo '-'; echo "&lt;/li&gt;"; } echo "&lt;ul&gt;"; ?&gt; &lt;/div&gt; </code></pre> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload