I will write what can be considered to keep value/variable when user moves pages from one to another.
- Use cookie. Keep the value in cookie in browser and read it later.
- Use DOMStorage (sessionStorage/localStorage) and keep the value in browser and read it later.
- Use session variable and keep the value in server and read it later.
- Use DB/SQL and keep the value in DB of server and use SQL to read it later.
- Use the web framework's functionality to connect to DB and to write SQL for DB.
Or, not keeping the value, but passing the value via Get/Post method is also good if the value is not complicated data (passing ID integer for example).
I think Get method is usually used for this purpose. Sending by POST is usually used when you want to save the data in DB after receiving.
I think Get method is usually used for this purpose. Sending by POST is usually used when you want to save the data in DB after receiving.