<?php

	//error_reporting(0);

	if( (!empty($_POST['arrive'])) && (!empty($_POST['depart']) ) )
	{ 
		
		$user = "root";
		$password = "";
		$host = "localhost";
		$db = "test";
		
		$db_connection = mysql_connect($host, $user, $password);
		mysql_select_db($db, $db_connection); 
	
		if(!$db_connection)
		{
			die('Could not connect: ' . mysql_error());
		}
	
		$nom = $_POST['nom'];
		$prenom = $_POST['prenom'];
		$adresse = $_POST['adresse'];
		$telephone = $_POST['telephone'];
		$email = $_POST['email'];
		$date_reservation = date("d-m-Y");
		$heure = date("H:i");
		$debut = $_POST['arrive'];
		$depart = $_POST['depart'];
		$status = $_POST['options_reservation'];
		
// `date_inscription` date NOT NULL default '0000-00-00',
// `heure_inscription` time NOT NULL default '00:00:00',
 
		$sql = "INSERT INTO reservation VALUES ('', '$nom', '$prenom' , '$adresse' , '$telephone', '$email',  '$date_reservation', '$heure', '$debut', '$depart', '$status')";
		echo $sql;
	
		
		mysql_query($sql);
		mysql_close();
		
/*$date = //ta date récuperé depuis ta base
$date = strtotime($date);
$date_site= date("d/m/Y",$date);
	*/
	}
?>


<html lang="fr">
<head>
<meta charset="utf-8">
<title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

<style>
		.dp-highlight .ui-state-default {
			background: #484;
			color: #FFF;
		}
</style>

</head>
<body>

		
<!--		<div id = "oto">
<!--		<form id="form-demande" method="post" action="#"> -->
		<form action="" method="post" id="ajouter_bloc" name="ajouter_bloc" >
<!--		<div id="datepicker"></div>  -->
	
		<!-- <label for="from">Arrivée:</label>
	<!-- 	<input type="text" id="arrive" name="arrive"> -->
	<!--	<label for="to">Départ:</label>
	<!--	<input type="text" id="depart" name="depart"> -->
		
		
	<!-- 	<input type="submit" value="OK"> 
		
		
<!--------  nouveau script -->		

		<table align="left" cellspacing="1" cellpadding="5" border="0" bgcolor="#D5D5D5" width="800">
		<tr bgcolor="#F1F3F5">
		<td colspan="2">Renseignements :</td>
		</tr>
								
		<input type="hidden" name="valide" id="valide" value="">
		
		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Nom :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" name="nom" size="70" maxlength="20" value="" id="" ></td>
		</tr>
		
		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Prénom :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" name="prenom" size="70" maxlength="20" value="" id="" ></td>
		</tr>

		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Téléphone :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" name="telephone" size="70" maxlength="20" value="" id="" ></td>
		</tr>

		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Email :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" name="email" size="70" maxlength="20" value="" id="" ></td>
		</tr>
		
		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Arrivée :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" id="arrive" name="arrive"></td>
		</tr>
		
		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Départ :</td>
		<td align="left" valign="middle" colspan="1">
		<input type="text" id="depart" name="depart"></td>
		</tr>
		
		<tr bgcolor="#FFFFFF">
		<td align="right">Status :</td>
		<td align="left">
		<select name="options_reservation" size="1">
		<option value="Reservation">Reservation</option>
		<option value="Annulation">Annulation</option>
		<option value="Loué">Loué</option> 
		<option value="Payement">Payement</option> 
		</select></td>
		</tr>
	
		<tr bgcolor="#FFFFFF">
		<td align="right" valign="top">Adresse :</td>
		<td align="left" valign="middle" colspan="1">
		<textarea style="resize:none" id = "adresse" name = "adresse" rows="5" cols="50"></textarea></td>
		</tr>	
				
				
		<tr bgcolor="#F1F3F5">
		<td colspan="2" align="center">
		<input type="submit" name="soumettre" value="Soumettre" />
		</td>
		</tr>
		
		</table>
		</form>
<!--		</div>  -->
		
		<script>
		/*
		 * jQuery UI Datepicker: Using Datepicker to Select Date Range
		 * http://salman-w.blogspot.com/2013/01/jquery-ui-datepicker-examples.html
		 */
		
		 $(function() {
			$( "#arrive" ).datepicker({
				defaultDate: "+1w",
				changeMonth: true,
				dateFormat: "dd-mm-yy",
			    showWeek: true,
				minDate: new Date(),
				altField: "#datepicker",
				closeText: 'Fermer',
				prevText: 'Précédent',
				nextText: 'Suivant',
				currentText: 'Aujourd\'hui',
				monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
				monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
				dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
				dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
				dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
				weekHeader: 'Sem.',
				firstDay: 1,
				onClose: function( selectedDate ) {
					$( "#depart" ).datepicker( "option", "minDate", selectedDate );
				}
		});

		$( "#depart" ).datepicker({

				defaultDate: "+1w",
				changeMonth: true,
				dateFormat: "dd-mm-yy",
			    showWeek: true,
				minDate: new Date(),
				altField: "#datepicker",
				closeText: 'Fermer',
				prevText: 'Précédent',
				nextText: 'Suivant',
				currentText: 'Aujourd\'hui',
				monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
				monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
				dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
				dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
				dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
				weekHeader: 'Sem.',
				firstDay: 1,
				onClose: function( selectedDate ) {
					$( "#arrive" ).datepicker( "option", "maxDate", selectedDate );
				}
		});
});
		
	</script>

</body>


</html>