0

I am trying to make a script that is effectively a processing PHP script in between two "steps" on a form (that are also separate PHP files). Basically, the data from step1 is taken to an interstitial page where it is processed, database is updated, etc., and then the user will be redirected to step2, but I need to create some POST data that will be sent to step2. I've seen numerous articles here on Stack about this, but they've all recommended using either cURL or a file_get_contents method which seems to be about sending data away to a script for processing and waiting for the answer to come back, which is sort of the opposite of what I want to do. The processing is done - I am now sending POST data to a new page to be used. How can I do this?

I don't think supplying code samples would help in this, but basically, a user's ID from the database was located in step1.php and is passed to step1_save.php via a hidden input field. I now need to be able to relay that again to step2.php via POST (I don't want to make it a GET and stash it in the URL) but the user needs to go to step2.php as part of a redirect. Any thoughts?

This is different than the other questions because of the reasons stated above. I don't want to pull the response in the same script, I just want to redirect the user. $_SESSION does not appear to let me create my own POST values. I want to create some organically, not only recycle ones from the previous script.

Josh Edgar
  • 109
  • 9
  • why not store the data in `$_SESSION` – Mark Vincent Manjac Nov 14 '16 at 03:06
  • @Mark How can I organically create $_POST values to store in $_SESSION? Only seems to be a way to recycle values from the previous page. – Josh Edgar Nov 14 '16 at 03:35
  • I don't get your question but I assume you already have the value in your `$_POST` so all you need to do is something like this `$_SESSION["sample"] = $_POST["value"]`. Or your could put all the values of your `$_POST` in an array something like `$arr = array("post1"=>"value1","post2"=>"value2")` then `$_SESSION["sample"] = $arr` – Mark Vincent Manjac Nov 14 '16 at 03:43

0 Answers0