<?php

?>
<div class="right_col" role="main">
    <div class="">
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
					<div class="x_title">
						<h2>Room Type Detail</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">

						<form class="form-horizontal form-label-left" method="post">

							
							<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="roomno">Room Type Title <span class="required">*</span></label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="roomno" class="form-control col-md-7 col-xs-12" name="title" type="text">
								</div>
							</div>
						
							<div class="ln_solid"></div>
							<div class="form-group">
								<div class="col-md-6 col-md-offset-3">
									<button id="send" type="submit" name="submit" class="btn btn-success">Submit</button>
									<button type="submit" class="btn btn-primary" onclick="javascript:window.location='index.php?pagecontent=dashboard'">Cancel</button>
								</div>
							</div>
						</form>
					</div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php

	if(isset($_POST['submit']))
	{
		$roomTypeTitle = $_POST['title'];
		$adminId = $_SESSION['admin'][0];
		
		mysqli_query($conn, "INSERT INTO room_types (rt_title, a_id)
		VALUES ('$roomTypeTitle', $adminId)") or die (mysql_error());
		
		header('Location: index.php?pagecontent=room_types');
		
		//TELEGRAM NOTIFICATION
		$adminUsername = $_SESSION['admin'][1];
		
$messaggio = "NEW ROOM TYPE ADDED BY ".$adminUsername."

Title : ".$roomTypeTitle."

".$ipAddress;

sendMessage($chatID, $messaggio, $token);
	}
?>