Function: textarea()

function textarea(array $parameters, bool $echo = true): string|null;

Function for rendering the text area field.

Details

This function renders a text area field that is bound to the request variable with the corresponding name.

Parameters

Name Pass type Value type Default value Description
$parameters by value array

The array of parameters as an associative array in the form key => value:

  • $parameters["id"] - id of the field.

  • $parameters["name"] - name of the field.

  • $parameters["value"] - value that should be set for the field. If it is not specified, the value of the corresponding request variable is taken.

Any other attributes may be specified.

Example:

textarea(["id" => "data_textarea",
          "name" => "data[textarea]",
          "class" => "my_class",
          "style" => "width: 300px; height: 150px;",
          "placeholder" => "enter the text",
          "title" => "enter the text",
          "data-prop" => "some-prop",
          "onblur" => "alert('Hello & Buy!')"
         ]);
$echo by value bool true

If the value of $echo is true, the html code of the field is directly echoed. Otherwise it is returned as string. It might be useful to pass this code to other rendering functions instead of echoing.

Returns

string|null

If the paramter $echo is true, the string of the field html code is returned, otherwise null.

Authors

Oleg Schildt

Package

Source code

See also