Does anyone know how to transfer $_POST data (HTML form data) from one page to another in Drupal?
I have two PHP pages I'm including in two different Drupal nodes, but I can't pass POST data between them.
Is there an easy way to do this?
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.
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.