2017-09-05 65 views
0

我试图创建一个网页,当用户点击下面的链接时,它会将用户带到下一页

我的问题是,我怎么能检索1 &页面显示它相同的数据在第二页文本框如下图所示pictuce?

Retrieve data

这是第2页

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

的观点,这是控制器

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); 
     } 

任何人可以帮助我在这个问题上?

您的帮助非常感谢。

+0

什么你问?它完全不清楚 –

+0

这个问题其实很清楚,尤其是提供的图像。 –

回答

1

简单的通过数据pro查看这样

在控制器中:

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

鉴于:

<input type="text" id="txtinput" name="txtinput" value="{$id}"> 
+0

我试着按照你说的去做,但是它在文本框中显示 <? }?> – Dn91

+0

试试这个''@ Dn91 – JYoThI

+0

感谢您的帮助, – Dn91

0

你传入数据作为查询字符串,所以下面应该工作

if(isset($_GET["pro")) { // Safeguard in case value is not there 
    $pro = $_GET["pro"]; 
} 

那么你的文本框的值赋给$pro

+0

对不起,我是否需要更改$ data ['idmsul'] = $ result;到 $ data = $ _GET [“pro”]; ?? – Dn91

+0

谢谢你抽出时间来帮助我,但我真的不明白你是怎么做到的......你能帮我解释一下吗? (ifset($ id)){echo $ id; – Dn91

相关问题