-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertForcamping.php
61 lines (51 loc) · 1.8 KB
/
insertForcamping.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
<?php
include 'dbh.inc.php';
session_start();
$UserID = $_SESSION['uID'];
?>
<?php
include 'dbh.inc.php';
if(isset($_POST['create'])) {
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$date = $_POST['date'];
$location = $_POST['location'];
$package = $_POST['package'];
$Participants = $_POST['Participants'];
$duration = $_POST['duration'];
$request = $_POST['request'];
$uname = $_SESSION['userName'];
$sql = "INSERT INTO campreservation(name, phone, email, date, location, package, Participants, duration, request,userName) VALUES('$name','$phone','$email','$date','$location', '$package', '$Participants', '$duration', '$request','$uname')";
$result = mysqli_query($conn,$sql);
if($result) {
header('location:viewCampDetails.php');
}
else {
die(mysqli_error($conn));
}
$conn->close();
}
if(isset($_POST['update'])) {
$id = $_POST['id'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$date = $_POST['date'];
$location = $_POST['location'];
$package = $_POST['package'];
$Participants = $_POST['Participants'];
$duration = $_POST['duration'];
$request = $_POST['request'];
$uname = $_SESSION['userName'];
$sql = "UPDATE campreservation SET name = '$name', phone = '$phone', email = '$email', date = '$date', location = '$location', package = '$package' , Participants = '$Participants', duration = '$duration', request = '$request' WHERE id='$id'";
$result = mysqli_query($conn,$sql);
if($result) {
header('location:viewCampDetails.php');
}
else {
die(mysqli_error($conn));
}
$conn->close();
}
?>