dongzhu0327 2013-11-21 20:28
浏览 66
已采纳

将值从视图传递到控制器到codeigniter中的另一个视图

I am trying to pass a value from a view to a controller then to a view, which does not work for a reason, here is my view link that passing the value

<a href="<?php echo site_url('social_controller/load_modal/'.$row->PageFbPageID.''); ?>">More</a>

Here is my controller

function load_modal() {
            $this->load->helper('url');
            $term = $this->uri->segment(3);
            $this->load->view('/modals/fetch_modal',$term);


        }

and here is my fetch_modal view

<? 
echo $term;
?>

when i click More, the link actually has the value i need in the uri but i can not seem to pass it to the controller and then to my view , i am getting a white page only.

  • 写回答

2条回答 默认 最新

  • duanchong3075 2013-11-21 20:38
    关注

    What if you first assign it in an array like this:

    $data['term'] = $this->uri->segment(3);
    

    and then pass it like this:

    $this->load->view('/modals/fetch_modal',$data);
    

    and in your view you access it like this:

    <? 
    echo $term;
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘