gpt4 book ai didi

php - 如何通过链接将值(value)转移到另一个页面?

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:00:29 25 4
gpt4 key购买 nike

Example

你好,我还在学习,使用 Codeigniter 谁能告诉我,或者给出示例代码?我需要的是 Round Id我们有111我想给它链接并搜索值为 111 的数据库,该怎么做?这是我试过但仍然不正确的代码

<div class="row" id="ajaxdata">
<table border="1">
<tr>
<th>Round Id</th>
<th>Player Id</th>
<th>Bet Place</th>
<th>Total Bet</th>
<th>Win</th>
<th>Lose</th>
</tr>

<?php foreach ($tbl_bet_spot as $data) {?>
<tr>
<td><a href="<?php echo site_url('account/detail_round_id?select=111');?>"><?php echo $data->round_id;?></a>
<td><?php echo $data->id;?></td>
<td><?php echo $data->bet;?></td>
<td><?php echo $data->total_bet;?></td>
<td><?php echo $data->win;?></td>
<td><?php echo $data->lose;?></td>
</tr>
<?php } ?>
</table>
</table>
</div>

Controller

public function detail_round_id(){
$select = $_GET['select'];

$data['tbl_bet_spot'] = $this->login_model->selectRoundId_by_round($select)->result();

print_r ($data);
}

我只是尝试使用我的代码,它现在可以工作了,但它在这里是静态的

<td><a href="<?php echo site_url('account/detail_round_id?select=111');?>"><?php echo $data->round_id;?></a>

我如何发送这个值 <?php echo $data->round_id;?>正确进入 Controller ?非常感谢。

最佳答案

使用此代码

<td><a href="<?php echo site_url()?>/account/detail_round_id/<?php echo $data->round_id;?>"><?php echo $data->round_id;?></a></td>

Controller

public function detail_round_id(){
$select = $this->uri->segment(3);

$data['tbl_bet_spot'] = $this->login_model->selectRoundId_by_round($select)->result();

print_r ($data);
}

关于php - 如何通过链接将值(value)转移到另一个页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39387680/

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