Search code examples
phpcodeigniterbrowser-history

creating back page links in Codeigniter


I have a page with URL http://arslan/admin/category/index/0/name/asc/10 in Codeigniter. In this URL, the uri_segment start from 0. This (0) is the default search value, name and asc are the default sort field and order, and 10 is the pagination index.

Now if I move to an add page with URL (http://arslan/admin/category/add/) similarly like above "add" is the current function.

Now if i want to go back through a link to back page... How can I divert the user back? I can't make the URL go back.

Can somebody help me please?


Solution

  • I am not sure if i understand the question correctly, if not please ignore my answer, but I think you want a link to "go back to previous page", similar to the back-button in a web browser.

    If so you could use javascript to solve this by simply using this line:

    <a href="javascript:window.history.go(-1);">Go back</a>