<?php
    include('header.php');
    

    $reg_mob = $_SESSION['session_mobile_number'];
    $seat_query = "SELECT * FROM std_ticket WHERE reg_mobile=".$reg_mob; 
	$seat_dt= $mysqli->query($seat_query);		

    $seats = $_POST['seatno'];
    $_SESSION['current_selected_seats'] = $_POST['seatno'];
    $seatsdetails = array();
    
    $curnt_st_cnt = 0;
    if(isset($_SESSION['current_selected_seats']) && count($_SESSION['current_selected_seats']) > 0){
        foreach($_SESSION['current_selected_seats'] as $stype=>$seatnos){
            foreach($seatnos as $sno){
                $seatsdetails[$stype][]=$sno;
                $curnt_st_cnt++; 
            }
        }
    }
    if ($seat_dt->num_rows > 0) {
        while($row_seat = $seat_dt->fetch_assoc()){                                                                        
            $seatsdetails[$row_seat["seat_type"]][]= $row_seat["seat_no"];              
        } 
    }    
    $_SESSION['current_select_seat_count'] = $curnt_st_cnt;
    $_SESSION['selected_seats'] = $seatsdetails;
?>
<div class="auto-container">
    <div class="row">
        <div class="details-pickup-section auto-container confirm">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-12 col-user-profile user-sid">                    
                    <div class="thank-you-msg">                        
                        You have selected below seats. Please confirm for proceed!!
                    </div>
                    <ul class="dashboard-data">
                        <li>
                            <a href="">
                                <span>Name</span>
                                <?= $_SESSION['login_name'] ?>
                            </a>
                        </li>
                        <li>
                            <a href="">
                                <span>Email</span>
                                <?= $_SESSION['reg_email'][0] ?>
                            </a>
                        </li>
                        <li>
                            <a href="">
                                <span>Mobile No</span>
                                <?= $_SESSION['session_mobile_number'] ?>
                            </a>
                        </li>
                    </ul>
                    
                    <ul class="dashboard-data">
                        <li class="sid-no">
                            <?php
                            if (count($seatsdetails) > 0) {
                            foreach($seatsdetails as $stype=>$seatnos){
                                foreach($seatnos as $sno){                                                           
                            ?>
                            
                            <span>
                                <?= strtoupper($stype.'-'.$sno); ?>
                            </span>
                            <?php } } }?>
                        </li>
                    </ul> 
                    <div class="cnfrm-btn">
                        <a href="selectseat.php" class="edit-btn" name="editbtn" id="editbtn" value="Edit">Edit</a>
                        <a href="saveticket.php" class="save-btn" name="confirmseat" id="confirmseat" value="Confirm">Confirm</a>                            
                    </div>                   
                </div>
                
            </div>
        </div>
    </div>     
</div>    
<?php
    include('footer.php');
?>