Show sourcecode

The following files exists in this folder. Click to view.

test/incl/blokket/

add-article.php
aside.php
blokket-default.php
data/
initiate.php
remove-article.php
show-all-articles.php
show-article.php
update-article.php

show-article.php

1 lines ASCII Unix (LF)
1
<?php
$path = "incl/blokket/data/";
$selected = "- Select article -";
?>

<h1>Show article</h1>
<fieldset>
    <form method="post">
        <p><label for="article-selection">Available articles:</label><br>
        <select id="article-selection" name="article-selection" onchange='form.submit();'>
            <?php
            if(isset($_POST['article-selection']))
                $selected = $_POST['article-selection'];
            $filenames = readDirectory($path);
            echo "<option value='- Select article -' selected>- Select article -</option>";
            $options = "";
            foreach ($filenames as $filename)
            {
                if($selected == $filename)
                    $options .= "<option value='" . $filename . "' selected>" . $filename . "</option>";
                else
                    $options .= "<option value='" . $filename . "'>" . $filename . "</option>";
            }
            echo $options;
            ?>
        </select></p>
    </form>
    <?php
    if(isset($_POST['article-selection']))
    {
        $contents = getFileContents($path . $_POST['article-selection']);
        echo "<p>" . $contents . "</p>";
    }
    ?>
</fieldset>