form

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.

Related topics

55 calls to form()

12 string references to 'form'

File

includes/common.inc, line 999
Common functions that many Drupal modules will need to reference.

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";
}
Login or register to post comments