<?php
$reservationstep = $_GET['reservationstep'];

if($reservationstep == "one"){
	$dpd1 = $_POST['dpd1'];
	$dpd2 = $_POST['dpd2'];
	$rooms	= $_POST['rooms'];
	$roomtype = $_POST['roomtype'];
	$adult	= $_POST['adult'];
	$children = $_POST['children'];
	echo "<div class=\"col-lg-3\">&nbsp;</div><div class=\"col-lg-6\">";
	echo "<form action=\"#\" method=\"post\" id=\"ajax-reservation-send\">";
	echo "<ul class=\"clearfix\">";
	echo "<input type=\"hidden\" name=\"dpd1\" value=\"$dpd1\" /><input type=\"hidden\" name=\"dpd2\" value=\"$dpd2\" /><input type=\"hidden\" name=\"rooms\" value=\"$rooms\" /><input type=\"hidden\" name=\"roomtype\" value=\"$roomtype\" /><input type=\"hidden\" name=\"adult\" value=\"$adult\" /><input type=\"hidden\" name=\"children\" value=\"$children\" />";
	echo "<li class=\"li-input sec-input\"><label>NAME</label><input type=\"text\" name=\"name\" required /></li>";
	echo "<li class=\"li-input sec-input\"><label>SURNAME</label><input type=\"text\" name=\"surname\" required /></li>";
	echo "<li class=\"li-input sec-input\"><label>PHONE</label><input type=\"text\" name=\"phone\" required /></li>";
	echo "<li class=\"li-input sec-input\"><label>E-MAIL</label><input type=\"text\" name=\"mail\" required /></li>";

	echo "<li><div class=\"button-style-1 margint40\"><a id=\"res-send\" href=\"#\"><i class=\"fa fa-search\"></i>SEND</a></div></li>";
	echo "</ul>";
	echo "</form>";	
	echo "</div><div class=\"col-lg-3\">&nbsp;</div>";

	

}elseif($reservationstep == "two"){
	$dpd1 = $_POST['dpd1'];
	$dpd2 = $_POST['dpd2'];
	$rooms	= $_POST['rooms'];
	$roomtype = $_POST['roomtype'];
	$adult	= $_POST['adult'];
	$children = $_POST['children'];
	$name = $_POST['name'];
	$surname = $_POST['surname'];
	$phone = $_POST['phone'];
	$mail = $_POST['mail'];
	$subject = $name." sent a reservation from website form.";

	$mainemail = "hello@edwinhgraphics.com";//Change this mail address.
	$mainemail2 = "apicalguesthouse@gmail.com";
	$mailinfo  = "MIME-Version: 1.0\r\n";
	$mailinfo .= "Content-type: text/html; charset=utf-8\n";
	$mailinfo .= "From:bookings@apicalguesthouse.com\r\n";
	$mailinfo .= "Reply-To: $name <$mail>\r\n";
	$sms  = "<strong>Details from reservation form</strong><br />Name : ".$name." ".$surname."<br />E-Mail : ".$mail."<br />Phone : ".$phone."<br />Arrival : ".$dpd1."<br />Departure : ".$dpd2."<br />Rooms : ".$rooms."<br />Room Type : ".$roomtype."<br />Adult : ".$adult."<br />Children : ".$children;

	$mail = mail($mainemail, $subject ,stripslashes($sms), $mailinfo);
	$mail = mail($mainemail2, $subject ,stripslashes($sms), $mailinfo);
	if($mail){
		echo "<p class=\"reservation-confirm\">Thanks for your request for a reservation. We're checking availability and we'll get back to you as soon as possible.</p>";
	}
	else{
		echo "<p class=\"reservation-confirm\">Error! Please try again.</p>";
	}
}else{
	echo "Error!";
}
?>