<?php include_once './config.php'; include_once './models/services/BrandService.php'; include_once './libs/Smarty.class.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset ($_POST['brand'])) { $_SESSION['brand'] = $_POST['brand']; header ('location:' . $_POST['action']); } else { $brandService = new BrandService(); $brands = $brandService->getAllBrands (); $smarty = new Smarty; $smarty->assign ('brands', $brands); $smarty->assign ('action', "selectbrand.php"); $smarty->assign ('current_brand', $_SESSION['brand']); $smarty->display ('views/selectbrand.tpl'); } ?>