I'm currently setting up default selections in <select> lists by
passing an array of those defaults as keys ( 'valuefoo' => true ) as
an argument to the function that sets up the list. Then, as I build
each <option>, I call array_key_exists ( thisoptionvalue,
arrayofdefaults ) to check whether to include the
'selected="selected"' string.
So the code looks something like
Routine ( array( 'valuefoo' => true, 'valuebar' => true ) ) ;
.....
function Routine ( $defaultvals )
{
for ( $i= etc. )
echo '<option....' . ( array_key_exists( 'curroptval',
$defaultvals ) ? 'selected="selected"' : '' ) . etc ' ;
}
(I've elided a lot of syntax, but you get the idea)
That seems slow and tedious. Does anyone know a cheaper way?
Thanks,
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)