When the user submit hi开发者_如何学JAVAs data, I take him to a different page where plenty of calculations are made, then I redirect him to the original page with a simple :
<?php header("Location:http://mysite.com/index.php");
The problem is I need all the variables and results to be show in this page, but they are obviously stored in the other one, so I need your help please :) ! Thank you for reading this !
PHP sessions.
session_start();
as the first thing on both (and all of your pages where you want to access this data).
set the variables you want to access as such:
$_SESSION["somekey"] = "somevalue";
then you can recall them on any of the other pages.
this functionality is reliant on session cookies, of course.
You can accomplish this through the use of sessions.
Don't forget you could use a database.
Sessions would be your best choice. See the other answer for the link to the php manual.
You could append them to the URI, but depending on field length and field counts that could be very messy (or not even possible, if too long).
If neither of these are options (too long, can't use cookies), you could can pass the session key along in the GET param. You can then use sessions normally.
精彩评论