0

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
  • What are you asking ? Its totally unclear Commented Sep 5, 2017 at 6:44
  • The question is actually quite clear, especially with the provided image. Commented Sep 5, 2017 at 6:48

2 Answers 2

1

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}">
Sign up to request clarification or add additional context in comments.

2 Comments

i try to do as you say,but it display this in the textbox <?php if(isset($id)){ echo $id; } ?>
Try this <input type="text" id="txtinput" name="txtinput" value="{$id}"> @Dn91
0

You are passing the data as a query string, therefore the following should work

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

Then assign the value of your textbox to $pro

2 Comments

Sorry for asking,do i need to change $data['idmsul'] = $result; into $data = $_GET["pro"]; ??
Thank you for taking time to help me,but i don't really understand how u do it...can u help explain a bit to me??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.