Hi All,

I was wondering if anyone could help. I have a list of websites to publish to in a CMS system that is called in via a function I created:

PHP Code:

        <?php 
            $type_array
=get_possible_sites(); 
            foreach (
$type_array as $sites
           { 
              print(
"<option value=\"".$sites['site_id']."\"" . ($site_id == $sites['site_id'] ? 'selected="selected"' '') . "> ".$sites['name']."</option>
                     <option value=\""
.$share_one."\"" . ($site_id == $share_one 'selected="selected"' '') . "> ".$share_one_name."</option>
                     <option value=\""
.$share_two."\"" . ($site_id == $share_two 'selected="selected"' '') . "> ".$share_two_name."</option>
                     <option value=\""
.$share_country."\"" . ($site_id == $share_country 'selected="selected"' '') . "> ".$share_country_name."</option>
                     <option value=\""
.$share_uk."\"" . ($site_id == $share_uk 'selected="selected"' '') . "> ".$share_uk_name."</option>
                     <option value=\""
.$share_group."\"" . ($site_id == $share_group 'selected="selected"' '') . "> ".$share_group_name."</option>\n"); 
                     
           } 
        
?>
Now some of these variable will be empty and contain nothing in them. Now rather than going through them one-by-one and saying:

PHP Code:

if ($share_two != '') {
//Output to the list
else
//Dont show on the list

Is there a more efficent way of doing this?

Thanks