case "add": echo "add"; $song = $_GET["song"]; $ctrl->addToPlaylist($song, $song); echo "Added {$song} to playlist<br>"; break; } ?> <a href="?action=play">play playlist</a> <form action="index.php" method="get"> Add song to playlist: <select name="song"> <?php foreach ($ctrl->getSongs() as $song) { echo "<option value='{$song}'>{$song}</option>"; } ?> </select> <button type="submit" name="action" value="add" >add</button> <p>Songs in playlist</p> <pre><?php echo $ctrl->getPlaylistContent(); ?> </pre> </form>
<?php include "autoload.php"; use Controller\LightShowController; $lightShow = new LightShowController(); if ($_POST['btnStart']) { $lightShow->playPlaylist(); } else { if ($_POST['btnStop']) { $lightShow->stop(); } } $songs[] = $lightShow->getSongs(); foreach ($songs as &$value) { echo $value; } ?> <html> <head> <title>Leuchtender Christbaum </title> </head> <body> <h1>Christmas Tree</h1> <form method="post" action="index.php"> <input type="submit" value="start playlist" name="btnStart" /> <input type="submit" value="stop playlist" name="btnStop" /> </form> </body>