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

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

See also

http://DOCUMENTATION_PENDING/node/717726

Related topics

File

modules/examples/form_example/form_example_tutorial.inc, line 69
This is the Form API Tutorial, originally from the Backdrop 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;
}