<?php 
if (isset($_REQUEST['bedallotment'])) {
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'insert' || $_REQUEST['action'] == 'edit')) {
        $result = $obj_bed->add_bed_allotment($_POST);
        if ($result) {
            if ($_REQUEST['action'] == 'edit') {
                wp_redirect(home_url() . '?dashboard=user&page=bedallotment&tab=bedallotlist&message=2');
            } else {
                wp_redirect(home_url() . '?dashboard=user&page=bedallotment&tab=bedallotlist&message=1');
            }
        }
    }
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
    $result = $obj_bed->delete_bedallocate_record($_REQUEST['allotment_id']);
    if ($result) {
        wp_redirect(home_url() . '?dashboard=user&page=bedallotment&tab=bedallotlist&message=3');
    }
}
if (isset($_REQUEST['message'])) {
    $message = $_REQUEST['message'];
    if ($message == 1) {
        ?>
			<div id="message" class="updated below-h2 ">
			<p>
			<?php 
        _e('Record inserted successfully', 'hospital_mgt');
        ?>
</p></div>
			<?php