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

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本