-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedit.php
68 lines (61 loc) · 1.49 KB
/
edit.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
<?php
session_start();
if(session_id()=='' || isset($_SESSION['username'])){
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "1234";
$dbname = "coffeecorner";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$user = $_SESSION['username'];
//$reserve_id = mysqli_real_escape_string($connection, $_POST['reserve_id']);
$sql = "(SELECT * FROM add_reservation WHERE username like '$user')";
$result = mysqli_query($connection, $sql);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Edit your reservation</title>
</head>
<body>
<div>
<h2>Reservation Update</h2>
<p>Select Reservation ID to edit:</p>
<form id="form" action="edit.php" method="get">
<?php
echo "<select name=\"Reservation ID\" form=\"form\">";
while ($row = mysqli_fetch_array($result))
{
$gg = $row['reserve_id'];
echo "<option value='" . $gg . "' name=\"reserve_id\">" . $gg . "</option>";
}
echo "</select>";
$_SESSION['reserve'] = $gg;
?>
<input type="submit" name="form" value="Submit">
</form>
</div>
<?php
if(isset($_GET['form']))
{
//echo $_POST['Reservation_ID'];
//print_r($_POST);
$identifier = $_GET['Reservation_ID'];
$sql1 = "SELECT * FROM add_reservation WHERE reserve_id LIKE '$identifier'";
$result1 = mysqli_query($connection, $sql1);
while($row = mysqli_fetch_array($result1))
{
echo "Reservation Details";
//echo $row['no_of_people'];
}
}
?>
</body>
<?php
}
else
{
header("location: login.php");
}
?>
</html>