<?php
include_once "header.php";
?>
<!-- Main -->
<div id="main-wrapper">
    <div class="container">
        <div class="row 200%">
            <div class="4u 12u(medium)">
                <?php
                include_once "sidebar.php";
                ?>
            </div>
            <div class="8u 12u(medium) important(medium)">
                <div id="content">

                    <!-- Content -->
                    <article>
                        <?php
                        $db = new Db();
                        $id = $_GET['id'];
                        $rows = $db->select("SELECT `Name`,`Description` FROM `countries` WHERE `Id`=" . $id);
                        if ($rows) { ?>
                            <h2><?php echo filter_var($rows[0]["Name"],FILTER_SANITIZE_STRING); ?></h2>
                            <?php echo filter_var($rows[0]["Description"],FILTER_SANITIZE_STRING); ?>
                            <br><br>
                            <h3>List of destinations:</h3>
                            
                            <?php
                            $db = new Db();
                            $rows = $db->select("SELECT `Id`,`Name` FROM `destinations` WHERE `countryId`=".$id." ORDER BY name ASC");
                            ?>

                            <?php
                            foreach ($rows as $row) {
                                echo "<a href='".Init::HOMEURL."destination/" . filter_var($row['Id'],FILTER_SANITIZE_NUMBER_INT) . "' title='Destination - " . filter_var($row['Name'],FILTER_SANITIZE_STRING) ."'>" . filter_var($row['Name'],FILTER_SANITIZE_STRING) . '</a><br>';
                            }
                            ?>
                        <?php } else { ?>
                            <h2>Not found</h2>
                            Restaurant was not found!
                        <?php } ?>



                    </article>

                </div>
            </div>
        </div>
    </div>
</div>
<?php
include_once "footer.php";
?>