<?php 
	//find user id
	// $getId = $_GET['id'] ? $_GET['id'] : NULL;
?>
<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>Reservation</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">
						<form class="form-horizontal form-label-left" method="post">
							<!-- <input id="name" class="form-control col-md-7 col-xs-12" name="id" type="text" value="<?php echo $getId; ?>" hidden> -->

							<div class="form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12">Team Name</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="name" class="form-control col-md-7 col-xs-12" name="teamName" type="text" value="">
							    </div>
							</div>
							
							<div class="form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12">Telegram Group Id</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="name" class="form-control col-md-7 col-xs-12" name="telegramGroupId" type="text" value="">
							    </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" class="btn btn-success" name="submit">Add</button>
								</div>
							</div>

						</form>
					</div>
                </div>
            </div>
        </div>
    </div>
</div>



<?php 

	if(isset($_POST['submit'])){

		$teamName = $_POST['teamName'];
		$telegramGroupId = $_POST['telegramGroupId'];
		
		//admin id
		$adminId = $_SESSION['admin'][0];

		mysqli_query($conn, "INSERT INTO teams (title,telegram_group_id,created_by) VALUES ('$teamName','$telegramGroupId',$adminId)");

		header("Location: ?pagecontent=teams");  
		//TELEGRAM NOTIFICATION
		// $adminUsername = $_SESSION['admin'][1];
		
// $messaggio = "NEW STAFF ADDED by ".$adminUsername."

// Name : ".$postFullName."
// Nickname : ".$postNickname."
// Name Code : ".$postNameCode."
// Contact : ".$contact."
// Email : ".$email."
// Note : ".$note."

// ".$ipAddress;

// sendMessage2(-550653212,$messaggio);
	}

?>



