Karan Adhikari Karan Adhikari - 1 month ago 13
PHP Question

Get value from url codeigniter

I have a domain and id is coming in that domain like this
http://www.test.com/update_record_row/id/6356/

I want id value from the domain without passing ? instead of / in (query string)

Answer
<a href="http://www.test.com/update_record_row/6356/"> ID </a>

public function update_record_row($id)
{
    echo "Id is :".$id;
}

or

Use URI segment

// if URL -http://www.test.com/update_record_row/id/6356/
$id = $this->uri->segment(3);

// if URL -http://www.test.com/update_record_row/6356/
$id = $this->uri->segment(2);