Suppose I have page 1 , the user enters some option for selecting data. The data is passed to page 2 , it draws the chart with data from ajax request.
I just wonder what is the better practice to use values from page 1 in page 2. I can come up with 3 approaches
var data1 = <?php echo $_GET['data1']?>
The best practice depends on your needs. Your methods work, and may be best for small, quick forms, but problems like load failures, timeouts, script errors and crashes could ruin the session. I would use a server-side database.
The advantage of temporarily storing the Page 1 information in a server database is that you could still have useful information (emails, addresses, etc.) if the user quits the session. This method will also let people pick up where they left off if they have to quit the session. With this method, you don't need to rely on volatile memory or insecure cookies to store information.
If the user doesn't submit Page 2, delete Page 1 information from the database regularly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.