OK, last one was answered quickly and successfully (thank you!), so here's another one.

Is there an easy way to set something in a select list to be selected? Right now I'm doing a real brute-force method. e.g.,

echo "<td><select name=\"disp_address\">";
$choices = array( 'pub' => 'On Public Page',
'members' => 'Only on Members Page',
'nodisp' => 'Do not Display' );
foreach ( $choices as $key => $choice ) {
$selected = '';
if ( strcmp( $key, $member_info->display_address ) == 0 ) {
$selected = 'selected';
}
echo "<option value=\"$key\" $selected>$choice";
}
echo '</select></td>';

I've got to imagine there's a better way ....

Thanks,
Dave


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to