如何回应不同页面的价值?

I have a table like this :

table

When I click update link, I want to echo the "nim" column (first column) to this page inside the nim input text.

enter image description here

Here is my controller

public function fupdate() {     
        $this->load->view('update_form_mhs');
}

public function update() {
}

Here is my view:

<tr>
    <td>NIM</td>                    
    <td><input type="text" placeholder="enter nim" name="nim"></td>
</tr>

How do I echo that?

You can send data from the listing page through GET method like:

<a href="xyz.php?nim=9004">9004</a>

And in the form page,

get nim through $_GET['nim']

So, the corrected code:

<td><input type="text" placeholder="enter nim" name="nim" value="<?php echo $_GET['nim']?>"/></td>

In the update method you need to do the following:

  • Grab the ID from the URL, which I assume is the number at the end of the update link (4441 in this case).
  • Fetch the row from the database which corresponds to this ID.
  • Echo out the details from that single row into the HTML code where you want it.

Now, since you haven't posted any code which relates to the actual fetching of the data, I'm afraid I cannot help you further with that. However, this step is pretty basic and should be well documented in the CI manual.