I am new to codeigniter. I am getting values from database into jobs page. In jobs page I am showing only three columns from jobs table from database. I have a link button as 'View More'. When user clicks on view-more link, then I want to show all job details based on it's id in viewjobs page.
How can I get id from jobs page to viewjobs page to display all data from jobs table from database? How can I get values in controller?
Please check my jobs controller code
class Careers extends CI_Controller {
public function jobs()
{
$this->load->database();
$this->load->model('xjobs');
$data['h']=$this->xjobs->xjobslist();
$this->load->view('jobs', $data);
}
}
Here is my jobs.php code from view.
<table class="table table-hover table-striped jobtable">
<thead style="background:#f4ae00; color:#fff; border-radius:5px 5px 0px 0px;">
<tr>
<th height="30" style="font-weight:400; font-size:18px;">Company Name</th>
<th style="font-weight:400; font-size:18px;">Job Title</th>
<th style="font-weight:400; font-size:18px;">Location</th>
<th style="font-weight:400; font-size:18px;">View</th>
</tr>
</thead>
<tbody>
<?php
foreach ($h->result() as $row)
{
?>
<tr>
<td height="60" style="padding-top:15px;"><?php echo $row->company; ?></td>
<td style="padding-top:15px;"><?php echo $row->position; ?></td>
<td style="padding-top:15px;"><?php echo $row->location; ?></td>
<td style="padding-top:15px;">
<a href='<?php echo base_url() ?>careers/viewjob?id=<?php echo $row->id; ?>&<?php echo $row->company; ?>&<?php echo $row->location; ?>' class='apply-btn'>View More</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>