-
Notifications
You must be signed in to change notification settings - Fork 0
/
slectroom2.php
203 lines (153 loc) · 5.51 KB
/
slectroom2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>International Amani Lodge</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<?php
$con = mysqli_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysqli_connect_error());
}
mysqli_select_db("argie_tamera", $con);
$confirm = $_POST['confirm'];
$result = mysqli_query($con,"SELECT * FROM reservation where confirmation='$confirm'");
while($row = mysqli_fetch_array($result))
{
$arival = $row['arrival'];
$departure = $row['departure'];
$adults = $row['adults'];
$child = $row['child'];
$confirmation=$row['confirmation'];
}
?>
<!--sa minus date-->
<script type="text/javascript">
// Error checking kept to a minimum for brevity
function setDifference(frm) {
var dtElem1 = frm.elements['start'];
var dtElem2 = frm.elements['end'];
var resultElem = frm.elements['result'];
// Return if no such element exists
if(!dtElem1 || !dtElem2 || !resultElem) {
return;
}
//assuming that the delimiter for dt time picker is a '/'.
var x = dtElem1.value;
var y = dtElem2.value;
var arr1 = x.split('/');
var arr2 = y.split('/');
// If any problem with input exists, return with an error msg
if(!arr1 || !arr2 || arr1.length != 3 || arr2.length != 3) {
resultElem.value = "Invalid Input";
return;
}
var dt1 = new Date();
dt1.setFullYear(arr1[2], arr1[1], arr1[0]);
var dt2 = new Date();
dt2.setFullYear(arr2[2], arr2[1], arr2[0]);
resultElem.value = (dt2.getTime() - dt1.getTime()) / (60 * 60 * 24 * 1000);
}
</script>
<!--sa error trapping-->
<script type="text/javascript">
function validateForm()
{
var y=document.forms["room"]["no_rooms"].value;
if ((y==null || y==""))
{
alert("all field are required!!!!!!!!!!!!!!!!!!! kuha mo? bobo");
return false;
}
}
</script>
<!--sa input that accept number only-->
<SCRIPT language=Javascript>
<!--
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
//-->
</SCRIPT>
</head>
<body>
<div class="mainwrapper">
<div class="leftother">
<div class="l"></div>
<div class="r">
<div class="right3">
<form action="personalinfoedit.php" method="post" onsubmit="return validateForm()" name="room">
<input name="start" type="hidden" value="<?php echo $arival; ?>" />
<input name="end" type="hidden" value="<?php echo $departure; ?>" />
<input name="adult" type="hidden" value="<?php echo $adults; ?>" />
<input name="child" type="hidden" value="<?php echo $child; ?>" />
<input name="confirmation" type="hidden" value="<?php echo $confirmation; ?>" />
<label style="margin-left: 119px;">Number of rooms: </label><INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="no_rooms" class="ed">
<span id="errmsg"></span>
<br />
<br />
<?php
$con = mysqli_connect("localhost","argie_policarpio","tamera");
if (!$con)
{
die('Could not connect: ' . mysqli_connect_error());
}
mysqli_select_db("argie_tamera", $con);
$result = mysqli_query($con,"SELECT * FROM room");
while($row = mysqli_fetch_array($result))
{
$a=$row['room_id'];
$query = mysqli_query($con,"SELECT sum(qty_reserve) FROM roominventory where arrival <= '$arival' and departure >= '$departure' and room_id='$a'");
while($rows = mysqli_fetch_array($query))
{
$inogbuwin=$rows['sum(qty_reserve)'];
}
$angavil = $row['qty'] - $inogbuwin;
echo '<div style="height: 117px;">';
echo '<div style="float: left; width: 100px; margin-left: 19px;">';
echo "<img width=92 height=72 alt='Unable to View' src='" . $row["image"] . "'>";
echo '</div>';
echo '<div style="float: right; width: 575px; margin-top: -10px;">';
echo '<span class="style5">'.'Avalable Rooms: '.$angavil.'</span>';
if ($angavil > 0){
echo '<input name="roomid" type="checkbox" value="' .$row["room_id"]. '" />';
echo '<input type="submit" name="Submit" value="reserve" onclick="setDifference(this.form);"/>';
}
if ($angavil <= 0){
echo '<span class="style5">'.'wala chansa wala gid vacant'.'</span>';
}
echo '<br>';
echo '<span class="style5">'.'Room Type: '.$row['type'].'</span><br>';
echo '<span class="style5">'.'Room Rate: '.$row['rate'].'</span><br>';
echo '<span class="style5">'.'Room Description: '.$row['description'].'</span><br>';
echo '</div>';
echo '</div>';
}
mysqli_close($con);
?>
<input type="hidden" name="result" id="result" />
</form>
</div>
</div>
</div>
<div class="rightother">
<div class="reservation">
<div align="center" style="padding-top: 7px; font-size:24px;"><strong>RESERVATION DETAILS</strong></div>
<div style="margin-top: 14px;">
<label style="margin-left: 16px;">Check In Date : <?php echo $arival; ?></label><br />
<label style="margin-left: 3px;">Check Out Date : <?php echo $departure; ?></label><br />
<label style="margin-left: 71px;">Adults : <?php echo $adults; ?></label><br />
<label style="margin-left: 78px;">Child : <?php echo $child; ?></label><br />
<BR />
</div>
</div>
</div>
</div>
<div class="footer" style="text-align:center; font-family:Arial, Helvetica, sans-serif; font-size:12px;">copyright � International Amani Lodge All Rights reserved</div>
</body>
</html>