Brimbox Logo Brimbox Version 2.3.4 Released


Method to output a select HTML form object using a resultset.

Class: bb_reports, called as $main

File: bb_reports.php (php)


function result_to_select($result, $name, $selected, $prepend = array(), $params = array())


$main->result_to_select($result, $name, $selected, $prepend = array(), $params = array());

Outputs: A dropdown menu based on the resultset supplied.

Note: Typically $result is a distinct single column; or the resultset can be reduced to a single column with pg_fetch_all_columns($result,0). Otherwise method uses the first column available. Also, display value for the select object this function creates is the same form or submitted value.

Parameter: $result (resultset)
A $result to populate the the select object.

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

Parameter: $selected (string)
Current selected value for select object.

Parameter: $prepend (string)
Value to prepend to the select object list of values.

Parameter: $params (string)
An associative array to turn into HTML attributes for the select object.

Updated: 2016-07-09