the function:Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Warning: Invalid argument supplied for foreach() in /home/joshua/includes/fyd.unifunc.php on line 294
Code: Select all
function array_to_options($array, $selected){
$optlist=''; # make an empty string
foreach($array as $key=>$value){
if($selected==$key){ # if this is the first time it wont match, so we don't need to care if it's set
$optlist=$optlist."<option value="$key" selected>$value</option>";
}else{
$optlist=$optlist."<option value="$key">$value</option>";
}
}
return $optlist;
}Code: Select all
# eye color
$eyecolor=array('0'=>'Blue', '1'=>'Brown', '2'=>'Green', '3'=>'Grey', '4'=>'Hazel');
# hair color
$haircolor=array('0'=>'Black', '1'=>'Blonde', '2'=>'Brown', '3'=>'Dyed', '4'=>'Red');