M5533
M5533

Reputation: 117

fetch view table values in another page while click on the button in codeigniter

i have one view candidates page in my application..in that page i display all the candidate details..in that page i gave one button called SCHEDULE INTERVIEW..when user click on the button i want to display that particular row candidates values in another page..i want to get only name and email of the particular candidate like:

Name:******
email:*******

like this i want to display that particular candidate details..

View page:

<div class="box-body">
  <table id="example2" class="table table-bordered table-hover">
    <thead>
      <tr>
        <th></th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Email</th>
        <th>Mobile Number</th>
        <th>experience</th>
        <th>CTC</th>
        <th>Expected Ctc</th>
        <th>role</th>
        <th>Current Location</th>
        <th>Desired Location</th>
        <th>Notice Period</th>
        <th>Resume</th>
        <th>Actions</th>
    </tr>
</thead>

<?php foreach ($view_candidates as $idata) { ?>
<tbody>
    <tr id="domain<?php echo $idata->user_id;?>">
        <td class="cell checkbox">
            <input type="checkbox" class="selectedId" name="selectedId" />
        </td>    
        <td><?php echo $idata->first_name;?></td>
        <td><?php echo $idata->last_name;?></td>
        <td><?php echo $idata->email;?></td>
        <td><?php echo $idata->mobile_number;?></td>
        <td><?php echo $idata->experience;?></td>
        <td><?php echo $idata->ctc;?></td>
        <td><?php echo $idata->expectedctc;?></td>
        <td><?php echo $idata->role_name;?></td>
        <td><?php echo $idata->current_location;?></td>
        <td><?php echo $idata->desired_location;?></td>
        <td><?php echo $idata->notice_period;?></td>
        <td><?php echo $idata->resume;?></td>
        <td>
            <a href="<?php echo base_url() ? >/index.php/Selection/Selection_process/<?php echo $idata->candidate_id; ?>" class="btn btn-info">Schedule interview</a>
        </td>
    </tr>
</tbody>

Can anyone help me.. How to do this..

Thanks in Advance..

Upvotes: 1

Views: 624

Answers (1)

Pathik Vejani
Pathik Vejani

Reputation: 4501

Something like below:

<?php

// controller
function candidate_detail($candidateid)
{
    $data = $this->model_name->get_candidate_detail($candidateid);
    $viewData['getCandidate'] = $data;
    $this->load->view('candidate_view',$viewData);
}

// model
function get_candidate_detail($candidateid)
{
    $q = $this->db->query("SELECT * FROM tbl_name WHERE candidate_id = $candidateid");
    if($q->num_rows() > 0) {
        return $q->row_array();
    } else {
        return '';
    }
}

?>

// view candidate_view

<div class="box-body">
  <table id="example2" class="table table-bordered table-hover">
    <thead>
      <tr>
        <th></th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Email</th>
        <th>Mobile Number</th>
        <th>experience</th>
        <th>CTC</th>
        <th>Expected Ctc</th>
        <th>role</th>
        <th>Current Location</th>
        <th>Desired Location</th>
        <th>Notice Period</th>
        <th>Resume</th>
    </tr>
</thead>

<tbody>
    <tr id="domain<?php echo $getCandidate['user_id'];?>">
        <td class="cell checkbox">
            <input type="checkbox" class="selectedId" name="selectedId" />
        </td>
        <td><?php echo $getCandidate['first_name'];?></td>
        <td><?php echo $getCandidate['last_name'];?></td>
        <td><?php echo $getCandidate['email'];?></td>
        <td><?php echo $getCandidate['mobile_number'];?></td>
        <td><?php echo $getCandidate['experience'];?></td>
        <td><?php echo $getCandidate['ctc'];?></td>
        <td><?php echo $getCandidate['expectedctc'];?></td>
        <td><?php echo $getCandidate['role_name'];?></td>
        <td><?php echo $getCandidate['current_location'];?></td>
        <td><?php echo $getCandidate['desired_location'];?></td>
        <td><?php echo $getCandidate['notice_period'];?></td>
        <td><?php echo $getCandidate['resume'];?></td>
    </tr>
</tbody>

Upvotes: 1

Related Questions