Solucionado, dejo el codigo completo.
Código PHP:
Ver originalinclude('../../includes/conn_sys.php');
$rs = $mysqli->query("SELECT * FROM nm_departamentos WHERE id_entidad='".$_SESSION['id_entidad']."' ORDER BY nombre_dpto");
echo "<select id='obj_dpto' class='cajatexto'>";
echo "<option value=''></option>";
if (isset($_SESSION['elemento'])==""){ while ($row = $rs->fetch_assoc()){ echo "<option value=".$row["id"].">" .$row["nombre_dpto"] ."</option>"; }
}else{
while ($row = $rs->fetch_assoc()){
echo "<option value='" .$row["id"] ."'";
if (!(strcmp($row['id'], $_SESSION['elemento']))) { echo "selected=\'selected\'"; } echo ">" .$row["nombre_dpto"] ."</option>";
}
echo "</select>";
}