在codeigniter中单击按钮时,在另一个页面中获取视图表值

时间:2017-02-25 04:53:41

标签: javascript jquery codeigniter

我在我的应用程序中有一个候选页面...在该页面我显示所有候选人详细信息..在该页面我给了一个名为SCHEDULE INTERVIEW的按钮..当用户点击按钮我想要显示该特定行候选人在另一页的价值观。我想获得特定候选人的姓名和电子邮件,如:

Name:******
email:*******
像这样我想显示那个特定的候选人细节..

查看页面:

<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>

任何人都可以帮助我.. 怎么做..

先谢谢..

1 个答案:

答案 0 :(得分:1)

如下所示:

<?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>