Definition

form($form, $method = 'post', $action = NULL, $attributes = NULL)
drupal-4-6/includes/common.inc, line 999

Description

Generate a form from a set of form elements.

@result An HTML string with the contents of $form wrapped in a form tag.

Parameters

$form An HTML string containing one or more form elements.

$method The query method to use ("post" or "get").

$action The URL to send the form contents to, if not the current page.

$attributes An associative array of attributes to add to the form tag.

Code

function form($form, $method = 'post', $action = NULL, $attributes = NULL) {
  if (!$action) {
    $action = request_uri();
  }
  return '<form action="'. check_url($action) .'" method="'. $method .'"'. drupal_attributes($attributes) .">\n". $form . form_token() ."\n</form>\n";
}