I have created a custom module that includes a hook_submit function. Is it possible to load another page/form at this point without having to do a redirect?
The reason being within the logic of the submit function, there are variables I would like to pass through to another page, but it consists of complex data structures (objects, arrays etc) which would not be appropriate for post/get data.
Thanks
hook_submit() is the tail end of the chain of form processing. Once it has completed it’s duties you have two options: redirect (either via drupal_goto() or by returning $form[“#redirect’]) to another page or do nothing, in which case the page you clicked the submit button on will be reloaded.
You have several options for passing data on to your redirect destination, $_SESSION and the database being the most frequently used. You also have the option of setting complex data values in the Drupal.settings object in javascript, but in this instance that doesn’t buy you much if your end goal is to parse that information via PHP.
Without specific information on what your end goal is it’s hard to provide specific advice, however assuming using $_SESSION or the database as a cache isn’t an option for you, you might consider looking into both core FAPI and ctools’ respective implementations of multi-part forms for additional guidance.