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

$MESSAGE_FAILURE =   '<blockquote>
                      <h1>
                          <div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-remove-sign"></span> Please select Event Type / Event Segment</div>
                      </h1>
                      <br>
                      <br>
                    </blockquote>';

if ($_POST['EVENT_TYPE'] == '0' || $_POST['EVENT_INDUSTRY'] == '0')
{
    $_SESSION['MESSAGE'] = $MESSAGE_FAILURE;
    header('Location: booking_event.php');
    die();
}


$_SESSION['EVENT_NAME'] = strtoupper(filter_var($_POST['EVENT_NAME'],FILTER_SANITIZE_STRING));
$_SESSION['EVENT_TYPE'] = $_POST['EVENT_TYPE'];
$_SESSION['EVENT_INDUSTRY'] = $_POST['EVENT_INDUSTRY'];
$_SESSION['EVENT_REMARKS'] = $_POST['EVENT_REMARKS'];

//$result = mysqli_query($con,"SELECT * FROM config_events WHERE EVENT_ID = '$_POST[EVENT_TYPE]'");
//$row = mysqli_fetch_assoc($result);
$row = DB::queryFirstRow("SELECT * FROM config_events WHERE EVENT_ID = %s",$_POST['EVENT_TYPE']);
$_SESSION['EVENT_TYPE_DISPLAY'] = $row['EVENT_TYPE'];


$CODE2 = $_POST['EVENT_INDUSTRY'];
//$result3 = mysqli_query($con,"SELECT * FROM config_industries WHERE INDUSTRY_CODE = '$CODE2'");
//$row3 = mysqli_fetch_assoc($result3);
$row3 = DB::queryFirstRow("SELECT * FROM config_industries WHERE INDUSTRY_CODE = %s",$CODE2);
$_SESSION['EVENT_INDUSTRY_DISPLAY'] = $row3['INDUSTRY_NAME'];
$_SESSION['EVENT_SEGMENT'] = $row3['SECTOR'];

$CODE = $_SESSION['EVENT_SEGMENT'];
//$result2 = mysqli_query($con,"SELECT * FROM config_sectors WHERE SECTOR_CODE = '$CODE'");
//$row2 = mysqli_fetch_assoc($result2);
$row2 = DB::queryFirstRow("SELECT * FROM config_sectors WHERE SECTOR_CODE = %s",$CODE);
$_SESSION['EVENT_SEGMENT_DISPLAY'] = $row2['SECTOR_NAME'];

header('Location: booking_contact.php');

?>