Return the result to the original page

When a user submits his data, I take him to another page where a lot of calculations are done, then I redirect him to the original page with a simple:

<?php header("Location:http://mysite.com/index.php");

      

The problem is that I need all the variables and results to be displayed on this page, but they are obviously stored in another, so I need your help, please :)! Thanks for reading this!

+2


a source to share


4 answers


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 as such:



$_SESSION["somekey"] = "somevalue";

      

then you can remember them on any of the other pages.

this functionality depends on the session files, of course.

+3


a source


You can accomplish this with sessions .



+1


a source


Sessions will be your best bet. See another answer for a link to the php manual.

You can add them to the URI, but depending on the length of the field and the number of fields that can be very messy (or even impossible if they are too long).

If none of these parameters (too long, cannot use cookies), you can pass the session key along with the GET parameter. Then you can use sessions normally.

0


a source


Don't forget that you can use a database.

0


a source







All Articles