I have a problem and I really need help.

I'm building a module, the first step is fill a form with some data... after the form is submited I need use the data entered by the user and display a new form.

I need to create the new form in the hook submit and I don't know how to do it.

I hope you can help me.

Thanks.

Comments

greylogic’s picture

Looks like what you need is a multistep form. There are two ways to do this

In validation or submission functions set $form_state['rebuild'] to TRUE. This will make the form api to call your form definition function with the form_state argument containing values from the current post data. You can create your new form here.

set $form_state['storage']. Typically if you would like to carry over user submitted values in a multistep form, you can store those values here. Any changes made to storage are persistent and similar to rebuild, your form definition function gets called with the post values set in form_state.

--------------------------------------------------------------
My attempt with Drupal - Jaanlo.com