Bitrix Site Manager

InputType

string
InputType(
 string type,
 string name,
 string value,
 mixed checked,
 bool print_value = false,
 string title = "",
 string add_to_tag = ""
)

The function InputType returns the HTML code of tags <input type="checkbox"> or <input type="radio">.

Parameters

ParameterDescription
type Type of the tag:
<input type="type" ... >

Possible values:
  • checkbox - non-exclusive multiple selection;
  • radio - exclusive single selection.
name Tag name:
<input name="name" ... >
value Tag values:
<input value="value" ... >
checked The value of this parameter is matched against the value of the parameter value. If the two values are equal, the control bocomes checked:
<input checked ... >
print_value If "true", the value of the parameter value is printed on the right of tag.
Optional; "false" by default.
title If print_value is not true and the title parameter is not empty, the title value is printed on the right of tag.
Optional. The default value is "".
add_to_tag Arbitrary HTML code to be added to tag:
<input add_to_tag ... >
Optional. The default value is "".

Example



<?
// Multiple selection

echo "Result:<pre>"; print_r($check); echo "</pre>";
echo "Select the desired options:<br>";
?>
<form action="" method="GET">
<?
echo "1:".InputType("checkbox", "check[]", "1", $check)."<br>";
echo "2:".InputType("checkbox", "check[]", "2", $check)."<br>";
echo "3:".InputType("checkbox", "check[]", "3", $check)."<br>";
?>
<br><input type="submit" value="OK">
</form>
<?
// Single selection

echo "Result: ".$radio."<br><br>";
echo "Select one of these:<br>";
?>
<form action="" method="GET">
<?
echo "1: ".InputType("radio", "radio", "1", $radio)."<br>";
echo "2: ".InputType("radio", "radio", "2", $radio)."<br>";
echo "3: ".InputType("radio", "radio", "3", $radio)."<br>";
echo "4: ".InputType("radio", "radio", "4", $radio)."<br>";
?>
<br><input type="submit" value="OK">
</form>