<?php
include_once('inc.function.php');
include_once('confdb.php');

$_POST['ITEM_ID'];
$_POST['ITEM_DESCRIPTION'];
$_POST['ITEM_AVAILABILITY'];

if(empty($_POST['check_list'])) {
    $MESSAGE = '<blockquote>
                      <h1>
                          <div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-ok-sign"></span> Please select an appropriate layout, if unsure just select "CUSTOM LAYOUT" in selection list.</div>
                      </h1>
                      <br>
                    </blockquote>';

    $_SESSION['MESSAGE'] = $MESSAGE;
    header('Location: booking.php');
    exit();
 }

    foreach($_POST['check_list'] as $check) {
    		      $result_detail = mysqli_query($con,"SELECT * FROM config_hall_capacity WHERE ID = '$check'");
                  $row_detail = mysqli_fetch_assoc($result_detail);
                  $SETUP_LAYOUT = $row_detail['LAYOUT'];
                  $SETUP_CAPACITY = $row_detail['FAC_CAPACITY'];
                  $INDEX = $check;
                  
                  $ITEM_CART = array ('SETUP_ID' => $check, 'ITEM_ID' => $_POST['ITEM_ID'] , 'ITEM_DESCRIPTION' => $_POST['ITEM_DESCRIPTION'], 'ITEM_AVAILABILITY' => $_POST['ITEM_AVAILABILITY'], 'SETUP_LAYOUT' => $SETUP_LAYOUT, 'SETUP_CAPACITY' => $SETUP_CAPACITY);
				  $_SESSION['ITEM_SELECTED'][$INDEX] = $ITEM_CART;
    }

header('Location: booking.php');

?>