Text field tag

From PHP on Trax

Jump to: navigation, search

text_field_tag( string $name, string $value = null, array $options = array() )

Description

Creates a standard text field.

$name a string which is the name of the text field (name="$name").

$value a string which is the value of the text field (value="value").

$options is an array of key => value pairs of options for the input tag.

  • "disabled" - If set to true, the user will not be able to use this input.
  • "size" - The number of visible characters that will fit in the input.
  • "maxlength" - The maximum number of characters that the browser will allow the user to enter.

Returns an input type="text" tag converting the $options into html options on the tag.

Examples



Code:
<?= text_field_tag("person"$person->name, array("size" => 25)) ?>
Output:
<input type="text" id="person" name="person" size="25" value="John" />
Personal tools