Home > OS >  How do i echo rows that have a specific id
How do i echo rows that have a specific id

Time:06-23

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

my view: <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');
    }

CodePudding user response:

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.

" " 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 :)

  • Related