How to get a search key when someone edits a result after a search

My project has a list of some entries. The user can search for entries by project name. After the search, the user can edit a specific entry. After editing, when the user clicks the Refresh button right now, he is redirected to the list page, but the search result is gone and all entries are displayed.

After the update, I want to show only found records, not all. How to return a search key? I do not want to use a session for this if there is any other better way.

I am using codeigniter.

For example:

There is a list of 10 entries. The user searches for entries by "ABC". The result, which has the project "ABC", as 5 entries. Then the user will edit one entry and update it. After updating, I want to display only 5 records with the search key "ABC". Now it displays 10 (ALL) entries, because I redirect to the list page without a search key. I have no idea how to do this. :(

+4
source share
5 answers

, , - - . , ​​ GET. , Params URL-, URL- :

exampledomain.com/users?name=steve&age=23

: lastpage, . , , URL- :

exampledomain.com/users/edit/34?lastpage=erasc1235234safvdadsrgdfgbvcdfgrt435

. Param- $_GET['lastpage'] ( CI, $this->input->get('lastpage')), lastpage , URL. serach , URL-.

0

, .

  • GET
  • SESSION
  • COOKIEvariable

3 4. - GET. domain.com/controller/function?keyword=ABC rldecode($_GET['keyword']); , .

0

,

1) ,

2) , .

, DB, TableforSearch, , , "ABC".

"ABC" , , Table TableforSearch UserId.

, , , . ., , , .

, , . ,

0

, - ( , ), , localStorage localStorage. ( , , .. , .)

-1

$_SESSION['mysearch'] = 'ABC' header("Location: /mysearch.php?criteria=" . urlencode($_SESSION['mysearch'])). "mysearch.php" ureldecode($_GET['criteria']), .

-1
source

Source: https://habr.com/ru/post/1611232/


All Articles