PHP - changing value of page using drop down menu

I have problem with this drop down menu. This code is part of form.php and is used by 2 pages, 1 page is working fine in which it will not show the “-assigned-”, where the other page is showing it. I don’t know why they both display differently.

assuming library is in first lines code above is:

<p><?php $currCategory = $sel_categ['cat_name']; ?>
<strong>CategoryType2:</strong> <select name="select_cat">
<?php if(!$currCategory) { ?>
     <!-- HIDDEN TO TEST BUG -->
     <!--  <option selected >--Unassigned--</option> -->
     <!-- '<option value="'.$catname.'">'.$catname.'</option>'; -->
     <option value="'.$catname.'">-assigned-<?php $catname?></option>
     <?php } ?>

<?php $categories = get_all_categs();
    while($rowArr = mysql_fetch_assoc($categories)){
   $selected = $rowArr['cat_name']==$currCategory?'selected':'';
       echo "<option ".$selected." id='".$rowArr['category_id']."'>".$rowArr['cat_name']."</option>";
       } ?>
    </select>
 </p>

my function:

function find_selected_filepage() {
    global $sel_categ;
    global $sel_filepage;
    if (isset($_GET['catg'])) {
        $sel_categ = get_categ_by_id($_GET['catg']);
        $sel_filepage = NULL;
    } elseif (isset($_GET['filepage'])) {
        $sel_categ = NULL;
        $sel_filepage = get_filepage_by_id($_GET['filepage']);
    } else {
        $sel_categ = NULL;
        $sel_filepage = NULL;
    }
}