$msg = "Sorry event not found.";
} else {
    $tmp = $wpdb->get_row("select * from " . EVENTS_SEATING_CHART_EVENT_TABLE . " where event_id = {$event_id}");
    if ($tmp !== NULL) {
        $seating_chart = $wpdb->get_row("select * from " . EVENTS_SEATING_CHART_TABLE . " where id = " . $tmp->seating_chart_id);
        if ($seating_chart !== NULL) {
            $seating_chart_id = $seating_chart->id;
        }
    }
    if ($seating_chart_id <= 0) {
        $msg = "Sorry no associated seating chart was found.";
    } else {
        if (isset($_POST['toggle_seat']) && count($_POST['seat_ids']) > 0) {
            foreach ($_POST['seat_ids'] as $v) {
                if ($_POST['occupied'] == 1) {
                    seating_chart::mark_seat_un_available($event_id, $v);
                } else {
                    seating_chart::mark_seat_available($event_id, $v);
                }
            }
            $msg = "Seat status updated";
        }
    }
}
?>
<div class="clear">&nbsp;</div>
<?php 
if ($msg != "") {
    ?>
<div id="message" class="updated fade" style="margin-top:5px;margin-bottom:5px;">
<?php