Passing $_POST data from page to page in Drupal

Solutions

As suggested by SenorAmor, sessions are the right way to share data between HTTP requests. If you are actually building a multi-step form in Drupal, you shouldn't do it by including forms in node. You should instead create a module and use Drupal's form API which can be used to build multi-step forms.

Consider using sessions as they do exactly what you're looking for.

+1 SenorArmor's suggestion, sounds like it's what you need.

However, if you're looking for a way to temporarily pass data (for example, going through two related forms) and you don't want to keep it in $_SESSION, you might be interested in hidden <input> tags. Put them in any form you want to keep old "POSTED" data in, and the values will be retained and passed into the next page submit (And thus, in the $_POST on the final page). Be sure to validate these inputs; people can change them too.

Tags: PHP / Drupal / Post

Similar questions

Getting $_POST empty in AJAX callback
I just want to send address information to drupal for check content existence through the AJAX. Request is sending successfully and callback function also executing. but I am not getting any data in $_POST array. here is my AJAX code. This is callback routing & function At where I am making mistake? is there any other way? Or is there any probl...
Use $_POST after submit form
I create a form and a page with controller in Drupal 8. I want print value of my example input after submit form. For example my input name is "Tel_number". My code in controller page is: But no resault print.
using $_POST values in form alter to add validation
it's not the first time that i get into trouble using $_post in a node form alter, this time i'd like some assistance. basically, i need to pass some parameters to a form (and i should not pass the appended to the url, as query parameters). but $_POST values don't work as expected (they work until reaching validation phase). So.. in a page i pass a...
$_POST undefined from remote server POST
I am writing a Drupal 7 module which is listening for HTTP POST messages to be sent by a 3rd party remote application. For testing I am sending messages using the Firefox Poster extension. If I POST the message, the following code fails to place any value in my local vars (I get 'undefined index'): However, if I send the message using GET, the vars...
drupal_mail - Need to Remove $_POST
I am new to the drupal_mail function and need help. The code I have works, but I want to get rid of the $_POST parameter to limit my security holes. I don't know how to get the posted variables without using the $_POST parameter, and ideally, I would like to single each parameter out to put a custom label on it. Any help would be greatly appreciate...
Upload file does not show up in $_POST or $_FILES, only $HTTP_RAW_POST_DATA
I am trying to add an async upload to my Drupal 6 custom module. The problem is, though, that when the upload occurs (I have a break point on my php function) no data can be seen in $_POST or $_FILES. All the data for the file gets put into $HTTP_RAW_POST_DATA. I would expect it to be in the $_FILES array. Can anyone tell me what I'm doing wrong. O...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.