How do I make $ _POST permanent?
if I have a search function for my site and I want the custom search preferences to be available on any page of my site where a search module is available that I can imagine to convert the variable $_POST
to a cookie ... but I just change then which was already created by another person I replaced and I don't know if his other pages will affect this search module if I start relying on the cookie ... so I was trying to create a persistent array $_POST
from which I can work. Is it possible?
source to share
I would look at using $ _SESSION. Place all search items into an array in $ _SESSION.
to give you an example:
say the user is looking for "apples"
add it to $ _SESSION ['search_items'] [] = "apples";
tell the user to then search for "oranges"
add it to $ _SESSION ['search_items'] [] = "oranges";
make sure you have session_start (); at the top of each page you plan on using the search function. then you can add and access search items in $ _SESSION
source to share