1 form_example_tutorial.inc form_example_tutorial_2($form, &$form_state)

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

Related topics

File

modules/examples/form_example/form_example_tutorial.inc, line 58
This is the form API tutorial.

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;
}