Ejemplo n.º 1
0
<?php

require 'Controller/ComputerController.php';
$computerController = new computerController();
$retriever = "<h1>Search For a Product</h1>\n\t\t\t  <hr/><br/>\n\t\t\t<form action = 'Search.php' method = 'post' width = '200px'>\n\t\t\t\tSearch for a Product <input type='text' name = 'productName'/>\n\t\t\t\t\n\t\t\t\t<input type = 'submit' name = 'create' value = 'Search'/><br/>\n\t\t\t</form>";
if (isset($_POST['create'])) {
    //Fill page with computers of the selected type
    $computerTables = $computerController->SearchComputers($_POST['productName']);
} else {
    //Page is loaded for the first time, no type selected -> Fetch all types
    $computerTables = $computerController->CreateComputerTables('%');
}
//Output page data
$title = 'Computer overview';
$content = $retriever . $computerTables;
include 'Template.php';
Ejemplo n.º 2
0
        $dbProductID = $col[0];
        $dbName = $col[1];
        $dbPrice = $col[2];
        $dbStockQuantity = $col[3];
        $dbSupplierID = $col[4];
    }
    if ($itemName == $dbName) {
        $_SESSION['itemName'] = $itemName;
        $_SESSION['quantity'] = $quantity;
        $_SESSION['price'] = $dbPrice;
        $_SESSION['productID'] = $dbProductID;
        $_SESSION['SupplierID'] = $dbSupplierID;
        header('Location: Checkout.php');
    } else {
        $retriever .= "<br>Incorrect Item name.";
    }
    mysql_close();
}
require 'Controller/ComputerController.php';
$computerController = new computerController();
if (isset($_POST['types'])) {
    //Fill page with computers of the selected type
    $computerTables = $computerController->CreateComputerTables($_POST['types']);
} else {
    //Page is loaded for the first time, no type selected -> Fetch all types
    $computerTables = $computerController->CreateComputerTables('%');
}
//Output page data
$title = 'Computer overview';
$content = $retriever . $computerController->CreateComputerDropdownList() . $computerTables;
include 'Template.php';