简体   繁体   中英

How do i echo rows that have a specific id

its shows in the last part of URL %201 instead of 1 only

my view: <td><a href="<?php echo site_url('CrudController/edit'); ?>/ <?php echo $row-> id ?>">Edit</a> | Delete </td> <td><a href="<?php echo site_url('CrudController/edit'); ?>/ <?php echo $row-> id ?>">Edit</a> | Delete </td>

my controller:

public function edit() {
        $this->load->view('crudEdit');
    }

Try the following:

<td><a href="<?php echo site_url('CrudController/edit') . '/' . $row->id; ?>">Edit</a> | Delete </td>

Note that there isn't really any reason to close the PHP tag just to display a slash, and then open the PHP tag again--so this should simplify things a bit.

"%20" is the URL encoding for the space character, which is coming from the space after the slash here: ?>/ <?

So by removing that extra whitespace, everything should work properly :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM