<?php
include ("config.inc");


//$currentYear = date("Y");

$query= mysql_query("SELECT * from member1");
$row = mysql_fetch_array($query);

//	$displayLeav = "B0001-".$currentYear;
//	$index = 1;


$value = $row['Aid'];


//$result = $db->query($query);

//$row = $result->fetch_assoc();
//echo "<script>alert('".$value."')</script>";

if ($_POST["submit"]== "register"){



	$date = $_POST["date"];
		$contactNo = $_POST["contactNo"];
		$BookingDate1 = $_POST["BookingDate"];
		$type= $_POST["type"];
		$Hour=$_POST["Hour"];
		$reason1 = $_POST["reason"];
	



		
			$query = "INSERT INTO member1 (appointmentID,number,date,contactNo,BookingDate,type,Hour,reason) VALUES ('$displayLeav','$index','$date','$contactNo','$BookingDate1','$type','$Hour','$reason1')";
			$result = $db->query($query);
			$db->close();
			echo "<script>alert('register successful')</script>";
			echo "<script language='javascript'>window.location='App.php'</script>";
		}
	

?>
<html>
<head>
<title>register</title>

</head>
<script type="text/javascript">	
	function chkA(t){
	
		var patt = /(\d*)\.{1}(\d{0,2})/;
		var donepatt = /^(\d*)\.{1}(\d{2})$/;
		var str = t.value;
		var result;
		if (!str.match(donepatt)){
			result = str.match(patt);
			if (result!= null){
				t.value = t.value.replace(/[^\d]/gi,'');
				str = result[1] + '.' + result[2] ;
				t.value = str;
			}else{
				if (t.value.match(/[^\d]/gi))
					t.value = t.value.replace(/[^\d]/gi,'');
			}
		}
	}
</script>

<body>
<link type="text/css" href="themes/base/ui.all.css" rel="stylesheet" />
	<script type="text/javascript" src="jquery-1.3.2.js"></script>
	<script type="text/javascript" src="ui.core.js"></script>
	<script type="text/javascript" src="ui.datepicker.js"></script>
	<link type="text/css" href="demos.css" rel="stylesheet" />
	<script type="text/javascript">
	$(function() {
		$('#datepicker').datepicker({
			changeMonth: true,
			changeYear: true
		});
		
		$('#datepicker2').datepicker({
			changeMonth: true,
			changeYear: true
		});
		
		$('#datepicker3').datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
	</script>
<form method="POST">
<center>
<p style="text-align:center;font-size:50;color:purple;font-family:monotype corsiva">
<b>Appointment</b></P>
<table>
<table border="3" align="center" cellpadding="5" cellspacing="0" bordercolor="white" bgcolor="rgb(236,236,236)" width="35%" rules="all">

<tr>
	<td width="30%">AppointmentID:</td>
	<td width="70%"><?echo $value?></td>
</tr>


<tr>
	<td>Date:</td>
	<td><input type="text" name="date" value="<?echo date('Y-m-d')?>" id="datepicker"></td>
</tr>

<tr>
	<td>Contact No:</td>
	<td><input type="text" name="contactNo"></td>
</tr>

<tr>
	<td>Appointment date:</td>
	<td><input type="text" name="BookingDate" id="datepicker2" onchange="calcDays()"><span id="fromArea"></span></td>
</tr>



<tr>
<tr><td>Services</td>
<td>
<select size="1" name="type" maxlength="10">
<option value="type">type</option>
<option value="hair Cut">Hair Cut</option>
<option value="Bath">Bath</option>
<option value="Cut nails">Cut Nails</option>
<option value="Beauty">Beauty</option>



								
</td>
</tr>
</select>


<tr>
<tr><td>Time</td>
<td>
<select size="1" name="Hour" maxlength="10">
<option value="">Hour</option>
<option value="8">08.00</option>
<option value="9">09.00</option>
<option value="10">10.00</option>
<option value="11">11.00</option>
<option value="12">12.00</option>
<option value="1">01.00</option>
<option value="2">02.00</option>
<option value="3">03.00</option>
<option value="4">04.00</option>
<option value="5">05.00</option>

</select>
								
</td>
</tr>
</select>
<tr>
	<td>Suggestion:</td>
	<td><input type="text" name="reason" rows="3" cols="60" wrap="hard"></td>
</tr>


<tr align="center">

<td colspan="2"><input type ="submit" value="register" name="submit"><input type ="reset" value="reset" name="reset"></td>
</tr>

	


</table>
<a href="login.php">Back to Login page</a>
</center>
</form>
</body>
</html>