Location: PHPKode > scripts > ISBN check > isbn-check/example.php
<?php
    echo "<html><body>\n";

    /*
     *  include class and create object
     */
    include_once 'isbntest.class.php';
    $currISBN = new ISBNtest;

    /*
     *    did we get an ISBN?
     */
    if ($_REQUEST[isbn]) {
        $currISBN->set_isbn($_REQUEST[isbn]);
        if ($currISBN->valid_isbn10() === TRUE) {
            echo "<p>The ISBN-10 " . $currISBN->get_isbn10() . " is <span style=\"color: green;\">valid</span>.</p>\n";
        } else {
            echo "<p>The ISBN-10 " . $currISBN->get_isbn10() . " is <span style=\"color: red;\">invalid</span>.</p>\n";
            echo "<p>The error reported is:<br /> " . $currISBN->get_error() . "</p>\n";
        }
        if ($currISBN->valid_isbn13() === TRUE) {
            echo "<p>The ISBN-13 " . $currISBN->get_isbn13() . " is <span style=\"color: green;\">valid</span>.</p>\n";
        } else {
            echo "<p>The ISBN-13 " . $currISBN->get_isbn13() . " is <span style=\"color: red;\">invalid</span>.</p>\n";
            echo "<p>The error reported is:<br /> " . $currISBN->get_error() . "</p>\n";
        }
    }

    /*
     *  input form
     */
    echo "<FORM ACTION=\"" . $PHP_SELF . "\" METHOD=\"get\">\n";
    echo "<B>isbn</B>\n";
    echo "<INPUT TYPE=\"Text\" NAME=\"isbn\" SIZE=\"15\" MAXLENGTH=\"15\" VALUE=\"" . $_REQUEST[isbn] . "\">\n";
    echo "<INPUT TYPE=\"Submit\" NAME=\"submit\" VALUE=\"Submit\">\n";
    echo "</form>\n";

    echo "</body></html>\n";

?>
Return current item: ISBN check