function ReadIcons()
{
global $icons;
$handle = opendir('../images/outlook_icons');
while ( $file = readdir( $handle ) )
{
if ( $file != "." && $file != ".." )
{
$icons["../images/outlook_icons/$file"] = ereg_replace("....$", " ", $file);
}
}
} //end function ReadIcons()
function IconList( $selected )
{
global $icons;
reset( $icons );
//print_r( $icons );
while ( list( $file, $option ) = each( $icons ) )
{
$IconString .= "<option value=\"$file\"";
if ( $file == $selected )
{
$IconString .= " selected";
}
//error belor in else-statement!!
else if ( !$selected )
{
$file = "";
$file = "../images/outlook_icons/nodetails.gif";
$IconString .= " selected";
}
//end-error part
$IconString .= ">$option</option>\n";
$iconfound = "yes";
} //end-while
return $IconString;
closedir( $handle );
These are the two functions i'm using. I then just call the function (ReadIcons) later on, and set IconOptions = IconList( $SelectIcon) where IconOptions is called in my form and SelectIcon is an image.
The list box has an image next to it, that when u choose an option from the list, the image changes accordingly. Ic an't get the image and the default list value to display. I get a block with an 'x' in it = image and the first option in my list as my list value.
I might take long to reply to this again, as i need to leave pronto. Will reply tomorrow.
Thank you for your time and help
Tasneem