[FX.php List] Editing a repeating field using a list menu

Gjermund Gusland Thorsen ggt667 at gmail.com
Sat Jul 8 04:36:18 MDT 2006


> <option value="<?php echo $value; ?>" <?php if($value=$itemData
> ['Category'][0]){?>selected<?php } ?>><?php echo $value; ?></option>

The error is in the = instead of == in your if statement, here is the
way I would solve this:

<?
foreach( $vlResult['valueLists']['categories'] as $key => $value ) {
	if( $value == $itemData['Category'][0] ) {
		$sel = 'selected';
	} else {
		$sel = '';
	}
	$vlCategoryOptions[] = '<option value="'. $value . '" '.$sel.'>';
}

$vlCategory = '<select name="Category">'
	. implode( "\n", $vlCategoryOptions )
	. '</select>';
?>


More information about the FX.php_List mailing list