doutui2883 2017-09-05 06:18 采纳率: 100%
浏览 200
已采纳

PHP-在Codeigniter中使用$ this-> db-> get() - > result()

I'm trying to create a web page that when user click on the below link,it will bring user to the next page

<a href="../try/sewcutrptsummary?pro={$row ->idmsul}" target="blank"">Link

My question is,how can i retrieve the same data from 1st page & display it in a textbox in 2nd page as shown in below pictuce?

Retrieve data

This is the view for the 2nd page

<div class="control-group">
<label for="proid" class="control-label">MSUL ID</label>
<div class="controls"> 
 <input type="text" id="txtinput" name="txtinput"value="">
<select id="prodtype" name="prodtype"onchange="checknumber();">
<option selected >--Select Product Type--</option>
 <option value="Main"  >Main</option>
 <option value="Sub">Sub</option>
</select>
</div>
<div class="controls" id="after" style="display : none">         
<select id="cutprod" name="cutprod" class="input-xxlarge">
</select>

<input id="generatebtn" type="button" class="btn-primary btn-small" onclick="generateRpt();" value="Generate" ></div>
</div>

and this is the controller

function index() {
        $this -> smarty -> assign("page", "View Cutting Report Summary");
        $this -> smarty -> assign("dataname", "Cutting Report Summary");
        $this -> smarty -> assign("pagename", "sewcutrptsummary");
        $this -> smarty -> assign("msg", "");
        $this -> smarty -> assign("script", "Yes");

        $idmsul = $this -> input -> get_post("pro");
        $query = "Select idmsul from sindi_schedule where idmsul='{$idmsul}' group by idmsul";
        $result = $this -> global_model -> query($query) -> result();
        $data['idmsul'] = $result;

        $this -> smarty -> view('sewcutrptsummary.tpl',$data);
        }

Can anybody assist me on this problem?

Your help is greatly appreciate.

  • 写回答

2条回答 默认 最新

  • dongya4089 2017-09-05 06:56
    关注

    Simple pass the data pro to view like this

    In controller :

    .....
    $data['idmsul'] = $result;
    $data['id'] =$this->input->get_post("pro"); //here pass the id to view 
    $this->smarty->view('sewcutrptsummary.tpl',$data);
    ....
    

    In view :

    <input type="text" id="txtinput" name="txtinput" value="{$id}">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)