<?php
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (strlen($_SESSION['clientmsaid']==50)) {
  header('location:logout.php');
  } else{
    if(isset($_POST['submit']))
  {
 $username=$_POST['username'];
 $password=$_POST['password'];
 $phonenumber=$_POST['phonenumber'];
 $name=$_POST['name'];
 $age=$_POST['age'];
 $vehicletype=$_POST['vehicletype'];
 $model=$_POST['model'];
 $batterytype=$_POST['batterytype'];
 $details=$_POST['details'];
 $jpg=$_POST['jpg'];
 $number=$_POST['number'];
 $min_vol=$_POST['min_vol'];
 $max_vol=$_POST['max_vol'];
 $type=$_POST['type'];
 
$sql="insert into usersbike(username,password,phonenumber,name,age,vehicletype,model,batterytype,details,jpg,number,min_vol,max_vol,type)values(:username,:password,:phonenumber,:name,:age,:vehicletype,:model,:batterytype,:details,:jpg,:number,:min_vol,:max_vol,:type)";
$query=$dbh->prepare($sql);
$query->bindParam(':username',$username,PDO::PARAM_STR);
$query->bindParam(':password',$password,PDO::PARAM_STR);
$query->bindParam(':phonenumber',$phonenumber,PDO::PARAM_STR);
$query->bindParam(':name',$name,PDO::PARAM_STR);
$query->bindParam(':age',$age,PDO::PARAM_STR);
$query->bindParam(':vehicletype',$vehicletype,PDO::PARAM_STR);
$query->bindParam(':model',$model,PDO::PARAM_STR);
$query->bindParam(':batterytype',$batterytype,PDO::PARAM_STR);
$query->bindParam(':details',$details,PDO::PARAM_STR);
$query->bindParam(':jpg',$jpg,PDO::PARAM_STR);
$query->bindParam(':ophnumber',$ophnumber,PDO::PARAM_STR);
$query->bindParam(':number',$number,PDO::PARAM_STR);
$query->bindParam(':min_vol',$min_vol,PDO::PARAM_STR);
$query->bindParam(':max_vol',$max_vol,PDO::PARAM_STR);
$query->bindParam(':type',$type,PDO::PARAM_STR);
 $query->execute();
 
    echo '<script>alert("Bikedata has been added.")</script>';




}

?>
<!DOCTYPE HTML>
<html>
<head>
	<title>Add Bikes</title>
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>

	<!-- Bootstrap Core CSS -->
	<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
	<!-- Custom CSS -->
	<link href="css/style.css" rel='stylesheet' type='text/css' />
	<!-- Graph CSS -->
	<link href="css/font-awesome.css" rel="stylesheet"> 
	<!-- jQuery -->
	<link href='//fonts.googleapis.com/css?family=Roboto:700,500,300,100italic,100,400' rel='stylesheet' type='text/css'>
	<!-- lined-icons -->
	<link rel="stylesheet" href="css/icon-font.min.css" type='text/css' />
	<!-- //lined-icons -->
	<script src="js/jquery-1.10.2.min.js"></script>
	<!--clock init-->
	<script src="js/css3clock.js"></script>
	<!--Easy Pie Chart-->
	<!--skycons-icons-->
	<script src="js/skycons.js"></script>
	<!--//skycons-icons-->
</head> 
<body>
<div class="page-container">
<!--/content-inner-->
<div class="left-content">
<div class="inner-content">
	
<?php include_once('includes/header.php');?>
				<!--//outer-wp-->
<div class="outter-wp">
					<!--/sub-heard-part-->
<div class="sub-heard-part">
<ol class="breadcrumb m-b-0">
<li><a href="dashboard.php">Home</a></li>
<li class="active">Add Bikes</li>
</ol>
</div>	
					<!--/sub-heard-part-->	
					<!--/forms-->
<div class="forms-main">
<h2 class="inner-tittle">Add Bikes </h2>
<div class="graph-form">
<div class="form-body">
<form method="post"> 
	<div class="form-group"> <label for="exampleInputEmail1">username</label> <input type="text" name="username" placeholder="username" value="" class="form-control" required='true'> </div>
	<div class="form-group"> <label for="exampleInputPassword">Password</label> <input type="password" name="password" placeholder="Password" value="" class="form-control" required='true'> </div>
	<div class="form-group"> <label for="exampleInputEmail1">phonenumber</label><input type="text" name="phonenumber" value="" placeholder=" phonenumber"  class="form-control" maxlength='10' required='true' pattern="[0-9]+"> </div>
	<div class="form-group"> <label for="exampleInputEmail1">name</label> <input type="text" name="name" placeholder="name" value="" class="form-control" required='true'> </div>
	<div class="form-group"> <label for="exampleInputEmail1">age</label><input type="text" name="age" value="" placeholder="age"  class="form-control" maxlength='4' required='true' pattern="[0-9]+"> </div>
	<div class="form-group"> <label for="exampleInputEmail1">vehicletype</label><input type="text" name="vehicletype" value="" placeholder="vehicletype"  class="form-control"  required='true'"> </div>
	<div class="form-group"> <label for="exampleInputEmail1">model</label><input type="text" name="model" placeholder="model" value="" class="form-control" required='true'> </div>
	<div class="form-group"> <label for="exampleInputEmail1">batterytype</label> <input type="text" name="batterytype" placeholder="batterytype" value="" class="form-control" required='true'> </div>
     <div class="form-group"> <label for="exampleInputEmail1">details</label> <input type="text" name="details" placeholder="details" value="" class="form-control" required='true'> </div>
     <div class="form-group"> <label for="exampleInputEmail1">jpg</label> <input type="text" name="jpg" placeholder="jpg" value="" class="form-control" required='true'> </div>
	<div class="form-group"> <label for="exampleInputEmail1">number</label> <input type="text" name="number" value="" placeholder="number"  class="form-control" maxlength='13'> </div>
	<div class="form-group"> <label for="exampleInputEmail1">min_vol</label> <input type="float" name="min_vol" value="" placeholder="min_vol"  class="form-control" > </div>
<div class="form-group"> <label for="exampleInputEmail1">max_vol</label> <input type="float" name="max_vol" value="" placeholder="max_vol"  class="form-control" > </div>
<div class="form-group"> <label for="exampleInputEmail1">type</label> <input type="text" name="type" placeholder="type" value="" class="form-control" required='true'> </div>
	
	 <button type="submit" class="btn btn-default" name="submit" id="submit">Save</button> </form> 
</div>
</div>
</div> 
</div>
<?php include_once('includes/footer.php');?>
</div>
</div>		
<?php include_once('includes/sidebar.php');?>
<div class="clearfix"></div>		
</div>
<script>
		var toggle = true;

		$(".sidebar-icon").click(function() {                
			if (toggle)
			{
				$(".page-container").addClass("sidebar-collapsed").removeClass("sidebar-collapsed-back");
				$("#menu span").css({"position":"absolute"});
			}
			else
			{
				$(".page-container").removeClass("sidebar-collapsed").addClass("sidebar-collapsed-back");
				setTimeout(function() {
					$("#menu span").css({"position":"relative"});
				}, 400);
			}

			toggle = !toggle;
		});
	</script>
	<!--js -->
	<script src="js/jquery.nicescroll.js"></script>
	<script src="js/scripts.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php }  ?>