2017-09-05 06:18
采纳率: 100%
浏览 190

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>
<div class="controls" id="after" style="display : none">         
<select id="cutprod" name="cutprod" class="input-xxlarge">

<input id="generatebtn" type="button" class="btn-primary btn-small" onclick="generateRpt();" value="Generate" ></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.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试创建一个网页,当用户点击以下链接时,它会将用户带到 下一页

&lt; a href =“../ try / sewcutrptsummary?pro = {$ row - &gt; idmsul}”target =“blank”“&gt; Link < / code>




 &lt; div class =“control-group”&gt; 
&lt; label for =“proid”class =“control-label”  &gt; MSUL ID&lt; / label&gt; 
&lt; div class =“controls”&gt; 
&lt; input type =“text”id =“txtinput”name =“txtinput”value =“”&gt; 
&lt; select id  =“prodtype”name =“prodtype”onchange =“checknumber();”&gt; 
&lt;选择选项&gt;  - 选择产品类型 - &lt; / option&gt; 
&lt; option value =“Main”&gt;  Main&lt; / option&gt; 
&lt; option value =“Sub”&gt; Sub&lt; / option&gt;  
&lt; / select&gt; 
&lt; / div&gt; 
&lt; div class =“controls”id =“after”style =“display:none”&gt;  
&lt; select id =“cutprod”name =“cutprod”class =“input-xxlarge”&gt; 
&lt; / select&gt; 
&lt; input id =“generatebtn”type =“button”class =“btn-  primary btn-small“onclick =”generateRpt();“  value =“Generate”&gt;&lt; / div&gt; 
&lt; / div&gt; 


  function index(){
 $ this this  - &gt; 聪明 - &gt;  assign(“page”,“View Cutting Report Summary”); 
 $ this  - &gt; 聪明 - &gt;  assign(“dataname”,“Cutting Report Summary”); 
 $ this  - &gt; 聪明 - &gt;  assign(“pagename”,“sewcutrptsummary”); 
 $ this  - &gt; 聪明 - &gt;  assign(“msg”,“”); 
 $ this  - &gt; 聪明 - &gt;  assign(“script”,“Yes”); 
 $ idmsul = $ this  - &gt; 输入 - &gt;  get_post(“pro”); 
 $ query =“从sindi_schedule中选择idmsul,其中idmsul ='{$ idmsul}'group by idmsul”; 
 $ result = $ this  - &gt;  global_model  - &gt; 查询($ query) - &gt;  result(); 
 $ data ['idmsul'] = $ result; 
 $ this this  - &gt; 聪明 - &gt;  view('sewcutrptsummary.tpl',$ data); 



  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

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 

    In view :

    <input type="text" id="txtinput" name="txtinput" value="{$id}">
    解决 无用
    打赏 举报

相关推荐 更多相似问题