<?php

/**
 * This page shows the user a drop down list of DVDs. One of these
 * will be hopefully selected for deletion.
 */
session_start();
include "../dvd-lib-common/head.php";
require_once "dvd-db.php";
ensure_authenticated();
try {
    $list = get_dvd_titles();
    $html_option_list = "";
    foreach ($list as $dvd) {
        $html_option_list .= "<option value='{$dvd}'>{$dvd}</option>\n";
    }
    ?>
    <h2>Select a DVD to Delete</h2>
    <form action='delete_selected.php' method='GET'>
    <table cellpadding=4>
        <tr><th>Title</th><td><select name ='title'><?php 
    echo $html_option_list;
    ?>
</select></td></tr>
        <tr><td></td><td><input type='submit' value='Delete'><input type='reset' value='Clear'</td></tr>
    </table>
    </form>
    <?php 
} catch (DbException $dbe) {
    echo "<h3 class='error'>The DVD list could not be fetched from the DB: {$dbe->getMessage()}.  <br />Please refresh the page to try again</h3>";
}
Exemple #2
0
 public function testDVDTitles()
 {
     $this->assertTrue(sizeof(get_dvd_titles()) > 0, "Should be titles in db");
 }
<?php

session_start();
require_once "dvd-db.php";
require_once "dvd-util.php";
include "../dvd-lib-common/head.php";
echo "<h2>All DVDs in the catalogue</h2>";
$all_dvds = get_dvd_titles("dvd");
if (sizeof($all_dvds) > 0) {
    echo "<ul>\n";
    foreach ($all_dvds as $title) {
        echo "<li><a href='view_dvd.php?part_title={$title}'>{$title}</a></li>\n";
    }
    echo "</ul>\n";
}
include "../dvd-lib-common/foot.html";