gpt4 book ai didi

mysql - 根据选择框值需要在 codeigniter 中显示 View 表

转载 作者:行者123 更新时间:2023-11-29 19:23:58 25 4
gpt4 key购买 nike

我的应用程序中有一个 View 选择表..我显示所有 View 选择详细信息..但我想要做的是我想根据角色名称显示 View 选择..我有role_id我的选择表..我在下拉列表中获取角色名称..

这是我的 Controller :

public function  vendor_view_selection()
{
$data['rolename']=$this->SelectionModel->getrolename();
$data['view_selection'] = $this->SelectionModel->getselection();
$this->load->view('selection/vendor_view_selection',$data);
}

这是我的模型:

function getselection() 
{
$this->db->select('*');
$this->db->from('selection');
$this->db->join('role','role.role_id= selection.role_id');
$this->db->join('candidates_details','candidates_details.candidate_id=selection.candidate_id');
$query = $this->db->get();
return $query->result();
}

角色名称选择框:(根据所选角色名称需要显示选择详细信息)

<div class="form-group">
<label>Choose RoleName</label>
<select class="form-control" multiple class="form-control" data-placeholder="Role name" name="role_id" >
<option value="0"></option>
<?php foreach($rolename as $rows) { ?>
<option value="<?php echo $rows->role_id?>"><?php echo ucfirst($rows->role_name)?></option>
<?php } ?>
</select>
</div>

View :(view_selection)表格

<div class="box-body">
<table id="" class="table table-bordered table-hover">
<thead>
<tr>
<th>selection </th>
<th>comments</th>
<th>results</th>
<th>candidate</th>
<th>role</th>
</tr>
</thead>
<?php
foreach ($view_selection as $idata) {
?>
<tbody>
<tr id="domain<?php echo $idata->selection_id;?>">
<td><?php echo $idata->selection;?></td>
<td><?php echo $idata->comments;?></td>
<td><?php echo $idata->results;?></td>
<td><?php echo $idata->candidate_id;?></td>
<td><?php echo $idata->role_id;?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>

请任何人帮助我如何做到这一点..提前致谢..

最佳答案

通过$.ajax将列表id发送到 Controller 中的特殊函数。

然后 echo $this->load->view('view_selection',array(),true);//返回view的字符串

退出();

我希望这对你有用,

关于mysql - 根据选择框值需要在 codeigniter 中显示 View 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42269322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com