Brimbox Logo Brimbox Version 2.3.4 Released

array_to_select>>

Method to output a form HTML select object from an array.

Class: bb_reports, called as $main

File: bb_reports.php (php)

Declaration:

 function array_to_select($arr, $name, $selected, $prepend = array(), $params = array())

Usage:

$main->array_to_select($arr, $name, $selected, $prepend, $params)

Outputs: A dropdown menu based on the array supplied.

Note: Array can be associative, hence the array keys become the values of the select object if usekey parameter is set.

Parameter: $arr (array)
Array used to build the select form object, can be indexed or associative.

Parameter: $name (string)
Name of the select object, usually passed through the submit algorithm.

Parameter: $selected (mixed)
Current selected value for select object, based on actual value of object (not the display value). This parameter could be an integer if using an indexed array with parameter usekey set to true.

Parameter: $prepend (string)
Array to prepend to the specified array.

Parameter: $params (optional array)
Associative array of parameters to pass. Unreserved parameters are turned in HTML attributes for the select object.

Array of parameters:

  • usekey, whether to use key/value pairs or just values

Updated: 2016-07-09