form($form, $method = 'post', $action = NULL, $attributes = NULL)
drupal/includes/common.inc, line 999
Generate a form from a set of form elements.
@result An HTML string with the contents of $form wrapped in a form tag.
$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.
| Name | Description |
|---|---|
| Form generation | Functions to enable output of HTML forms and form elements. |
| Input validation | Functions to validate user input. |
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";
}