1
1. Shouldn't addOptionArray take an array of arrays? This is how data comes back from a query.
2. What methods have been used to convert to a one-dimensional array? Most of the examples grep'ed above the modules directory show 'static' input such as
$x->addOptionArray(array('3600' => _HOUR, '18000' => sprintf(_HOURS
, 5));
or I have found examples of a one dimensional array containing text values that was automatically indexed.
I'm creating select options for admin forms using XoopsFormSelect.
The HTML I hope to create is;
so that when the form is posted, I can act on the option value which is the record id.
My database query comes back looking like this (an array or arrays);
$array[0] = array( 'value'=>6,'cat'=>'acategory')
$array[1] = array( 'value'=>2,'cat'=>'bcategory')
and can easily be converted to this;
$array[0] = array('6'=>'acategory')
$array[1] = array('2'=>'bcategory')
addOptionArray would want these to look like this;
$array = array ('6'=>'acategory','2'=>'bcategory')
Before I present my patented kludge for the conversion, I thought I would ask....