function form_example_tutorial_8_page_two_submit

The page 2 submit handler.

This is the final submit handler. Gather all the data together and output it in a drupal_set_message().

Related topics

1 string reference to 'form_example_tutorial_8_page_two_submit'
form_example_tutorial_8_page_two in form_example/form_example_tutorial.inc
Returns the form for the second page of form_example_tutorial_8().

File

form_example/form_example_tutorial.inc, line 521

Code

function form_example_tutorial_8_page_two_submit($form, &$form_state) {
    // Normally, some code would go here to alter the database with the data
    // collected from the form. Instead sets a message with drupal_set_message()
    // to validate that the code worked.
    $page_one_values = $form_state['page_values'][1];
    drupal_set_message(t('The form has been submitted. name="@first @last", year of birth=@year_of_birth', array(
        '@first' => $page_one_values['first'],
        '@last' => $page_one_values['last'],
        '@year_of_birth' => $page_one_values['year_of_birth'],
    )));
    if (!empty($page_one_values['first2'])) {
        drupal_set_message(t('Second name: name="@first @last", year of birth=@year_of_birth', array(
            '@first' => $page_one_values['first2'],
            '@last' => $page_one_values['last2'],
            '@year_of_birth' => $page_one_values['year_of_birth2'],
        )));
    }
    drupal_set_message(t('And the favorite color is @color', array(
        '@color' => $form_state['values']['color'],
    )));
    // If we wanted to redirect on submission, set $form_state['redirect']. For
    // simple redirects, the value can be a string of the path to redirect to. For
    // example, to redirect to /node, one would specify the following:
    //
    // $form_state['redirect'] = 'node';
    //
    // For more complex redirects, this value can be set to an array of options to
    // pass to drupal_goto(). For example, to redirect to /foo?bar=1#baz, one
    // would specify the following:
    //
    // @code
    // $form_state['redirect'] = array(
    //   'foo',
    //   array(
    //     'query' => array('bar' => 1),
    //     'fragment' => 'baz',
    //   ),
    // );
    // @endcode
    //
    // The first element in the array is the path to redirect to, and the second
    // element in the array is the array of options. For more information on the
    // available options, see http://api.drupal.org/url.
}