How to display data on next page but getting error in PHP using Codeigniter?
<p>When i clicking on link i want to show respected id data on next page using Codeigniter but i getting error of <code>Undefined variable: id</code></p>

<p>This is my index view file</p>

<pre><code>&lt;a itemprop="title" style="text-transform: capitalize;color:#29aafe" href="&lt;?=site_url('jobdetails?#'.$row-&gt;JPostID);?&gt;"&gt;&lt;?=$row-&gt;JTitle;?&gt;&lt;/a&gt;
</code></pre>

<p>This is mymodel</p>

<pre><code>public function getRowByJob($id){
        $query = $this-&gt;db-&gt;get_where('jobs', array('JPostID' =&gt; $id));
        if($query-&gt;num_rows() &gt; 0)
            return $data-&gt;result();                    
    }
</code></pre>

<p>this is my controller</p>

<pre><code>public function jobdetails(){
        $data = array();
        $data['jobdata'] = $this-&gt;mymodel-&gt;getRowByJob($id); // it is model method to fetch the record of that users having id = $id
        $this-&gt;load-&gt;view('jobdetails',$data);          
    }
</code></pre>

<p>This is my jobdetails view file</p>

<pre><code>&lt;?php foreach($jobdata as $row){?&gt;                                        
                 &lt;div class="block-section box-item-details" itemscope itemtype="http://schema.org/JobPosting"&gt;
                    &lt;h2 class="title" itemprop="title" style="text-transform: capitalize;"&gt;&lt;?=$row-&gt;JTitle;?&gt;&lt;/h2&gt;&lt;/div&gt;
</code></pre>

<p>I am getting following error</p>

<p><a href="http://i.stack.imgur.com/K1I4N.jpg" rel="nofollow">undefined variable:id</a></p>

<p><a href="http://i.stack.imgur.com/At4Q5.jpg" rel="nofollow">Invalid argument supplied for foreach()</a></p>