<?php 
    # $Id: benchmarkSet_ADD.php,v 1.2 2007/01/08 12:51:13 jarda Exp $

    /* Page that adds a new benchmark set to database
    */

    require_once('simplePage.inc.php'); 

    class PageClass extends EditDBSimplePage
    {

        function checkEnvironment()
        {
            if (!$_POST['OK'])
                return True;

            if (!$_POST['name'])
                return False;

            return True;
        }


        function handleInvalidEnvironment()
        {
            header("Location: benchmarkSets_LISTING.php"); /* Redirect browser */
        }


        function createPage()
        {
            if (!$_POST['OK'])
            {
                header("Location: index.php"); /* Redirect browser */ 
                exit();
            }

            $name = $_POST['name'];
            $description = $_POST['description'];

            $db = connect();
            
            $query = "INSERT INTO benchmarkSet " .
                     "(name, description) " .
                     "VALUES ('$name', '$description')";

            $db->Execute($query);

            header("Location: benchmarkSets_LISTING.php"); /* Redirect browser */ 
        }
    }

    launchPage();
    
    # vim:enc=iso8859-2:fenc=iso8859-2:
?>

