<?PHP
$table = "$prefix" . "CATEGORIES";
?>

<div class="primebox" id="categorybox" style="width:100%; z-index:1; height: 300px; overflow: auto;">

<?PHP /* (LANGUAGE) */ $t = "Multiple Categories Selectable"; $f = "categorycaption"; include "langinc.php"; /* (LANGUAGE) */ ?>

<br>

<br>

<?PHP
//........................
$sqlC="SELECT * FROM $table WHERE PARENT = '$parent' ORDER BY TITLE ASC";
$resultC = @mysql_query($sqlC);
while($rowC = @mysql_fetch_array($resultC))
{
$crow = $rowC[ID];
//.....................
?>

<input type="hidden" name="<?php echo $rowC[ID]; ?>" value="">

<input type="checkbox" name="<?php echo $rowC[ID]; ?>" value="<?php echo $rowC[ID]; ?>" <?PHP if (!empty($row[$crow])) echo checked; ?>>

<span class="medium"><?PHP echo $rowC[TITLE]; ?></span>

<br>

<?PHP
        //........................

        $sqlD="SELECT * FROM $table WHERE PARENT = '$rowC[ID]' ORDER BY TITLE ASC";
        $resultD = @mysql_query($sqlD);
        while($rowD = @mysql_fetch_array($resultD))
        {
        $crow = $rowD[ID];

        //.....................
        ?>
        
        <input type="hidden" name="<?php echo $rowD[ID]; ?>" value="">

        <input style="margin-left: 20px;" type="checkbox" name="<?php echo $rowD[ID]; ?>" value="<?php echo $rowD[ID]; ?>" <?PHP if (!empty($row[$crow])) echo checked; ?>>

        <span class="small"><?PHP echo $rowD[TITLE]; ?></span>

        <br>

        <?PHP
                //........................

                $sqlE="SELECT * FROM $table WHERE PARENT = '$rowD[ID]' ORDER BY TITLE ASC";
                $resultE = @mysql_query($sqlE);
                while($rowE = @mysql_fetch_array($resultE))
                {
                $crow = $rowE[ID];

                //.....................
                ?>
                
                <input type="hidden" name="<?php echo $rowE[ID]; ?>" value="">

                <input style="margin-left: 37px;" type="checkbox" name="<?php echo $rowE[ID]; ?>" value="<?php echo $rowE[ID]; ?>" <?PHP if (!empty($row[$crow])) echo checked; ?>>

                <span class="verysmall"><?PHP echo $rowE[TITLE]; ?></span> <br>

                <?PHP
                }
                ?>

        <?PHP
        }
        ?>

<?PHP
}
?>

</div>
