I have a form A and a form B.
I would like to make form A redirect the user to form B AND inform form B of the choices made in form A
Form A’s submit function (does not work):
function recruitment_select_team_submit($form, &$form_state)
{
// Forward to the next page.
$items['yourmod/foo/%/delete'] = array(
'title' => 'goto next page',
'page callback' => 'drupal_get_form',
'page arguments' => array('recruitment_form', 1), // second argument is the paramter for the team_id (test value)
//'access arguments' => array('delete foo rows'),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
Form B’s form:
function recruitment_form()
{
$team_id = 1;
if(db_query('select count(*) from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield() == 0)
{
die('Sorry but the team with team ID '.$team_id.' does not exist. If you feel this is a mistake please contact us.');
}
$team_terms = db_query('select terms from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield();
$team_requirements = db_query('select recruit_requirements from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield();
......
}
Hanito’s link to multiform example in the comments to your question would be my first recommendation… however if you really need form B to be a separate form or that’s beyond your control, you could probably just store the form values of form A in a session var, and then set the $form[‘redirect’] value to the path of form b.
example.