Same name and namespace in other branches
  1. 6.x-1.x form_example/form_example_tutorial.inc \form_example_tutorial_2()

This is Example 2, a basic form with a submit button.

See also

http://drupal.org/node/717726

Related topics

1 string reference to 'form_example_tutorial_2'
form_example_menu in form_example/form_example.module
Implements hook_menu().

File

form_example/form_example_tutorial.inc, line 69
This is the Form API Tutorial from the handbook.

Code

function form_example_tutorial_2($form, &$form_state) {
  $form['description'] = array(
    '#type' => 'item',
    '#title' => t('A simple form with a submit button'),
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
  );

  // Adds a simple submit button that refreshes the form and clears its
  // contents. This is the default behavior for forms.
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );
  return $form;
}