-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditEvent.php
executable file
·184 lines (135 loc) · 5.94 KB
/
editEvent.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
<script type="">
function showSpecify(x)
{
if(x=='Others')
$('#specifySpan').removeClass("hidden");
else
$('#specifySpan').addClass("hidden");
}
</script>
<?php
$eventID = $_REQUEST['eventID'];
$q = mysqli_query($con,"select * from tblevents where fldEventID = '$eventID'");
$qf = mysqli_fetch_array($q);
$status = $qf['fldStatus'];
$evType = $qf['fldEventType'];
$dateTime = $qf['fldEventDateTime'];
$dateTime = str_replace("-","/",$dateTime);
$dateTime = date("Y-m-d\TH:i:s",strtotime($dateTime));
//2018-06-07T00:00
echo $dateTime;
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Edit Client Details
</h1>
</section>
<br>
<form method="post">
<div class="box">
<div class="box-header with-border">
<h1 class="box-title"><?php echo $qf['fldEventName'] ?></h1>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="form-group">
<label>Event Title</label>
<input type="text" value="<?php echo $qf['fldEventName'] ?>" name="eventName" required class="form-control" placeholder="Event Title...">
</div>
<div class="form-group">
<label>Event Type</label>
<?php echo $evType; ?>
<select required onchange="showSpecify(this.value)" name="eventType" class="form-control">
<?php
if($evType == 'Wedding')
{
?>
<option value="" disabled>--Select One--</option>
<option selected value="Wedding">Wedding</option>
<option value="Birthday">Birthday</option>
<option value="Corporate">Corporate</option>
<option value="Others">Others</option>
<?php
}
else if($evType == 'Birthday')
{
?>
<option value="" disabled>--Select One--</option>
<option value="Wedding">Wedding</option>
<option selected value="Birthday">Birthday</option>
<option value="Corporate">Corporate</option>
<option value="Others">Others</option>
<?php
}
else if($evType == 'Corporate')
{
?>
<option value="" disabled>--Select One--</option>
<option value="Wedding">Wedding</option>
<option value="Birthday">Birthday</option>
<option selected value="Corporate">Corporate</option>
<option value="Others">Others</option>
<?php
}
?>
</select>
</select>
<br>
<span id="specifySpan" class="hidden">Please specify: <input type="text" id="eventTypeOthers" name="eventTypeOthers" placeholder="Specify Event..." class="form-control"></span>
</div>
<div class="form-group">
<label>Target Venue</label>
<textarea class="form-control" rows="3" name="venueAddr" required placeholder="Complete Venue Address..."><?php echo $qf['fldEventVenue'] ?></textarea>
</div>
<div class="form-group">
<label>Target Date and Time</label>
<input type="datetime-local" required name="eventDateTime" value="<?php echo $dateTime ?>" class="form-control">
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-xs-12 col-lg-12">
<div class="form-group">
<label>Event Price</label>
<div class="input-group">
<span class="input-group-addon"><i>PHP</i></span>
<input type="number" required name="eventPrice" value="<?php echo $qf['fldCost'] ?>" class="form-control" min="1">
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Event Status</label>
<input type="text" required name="eventStatus" class="form-control" value="<?php echo $qf['fldStatus'] ?>">
</select>
</div>
<div class="form-group">
<label>Event Notes</label>
<textarea class="form-control" rows="3" name="notes" required placeholder="Event Notes..."><?php echo $qf['fldNotes'] ?></textarea>
</div>
<input type="submit" class="btn btn-success" name="editDetails" value="Save Changes">
</form>
<a href="?p=events" class="btn btn-default">Cancel</a>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
<?php
if(isset($_POST['editDetails']))
{
$eventName = mysqli_real_escape_string($con,$_POST['eventName']);
$eventType = $_POST['eventType'];
if($eventType == "Others")
{
$eventType = mysqli_real_escape_string($con,$_POST['eventTypeOthers']);
}
$eventVenue = mysqli_real_escape_string($con,$_POST['venueAddr']);
$originalDate = $_POST['eventDateTime'];
$eventDateTime = date("m-d-Y h:i A", strtotime($originalDate));
$eventNotes = mysqli_real_escape_string($con,$_POST['notes']);
$eventPrice = $_POST['eventPrice'];
$eventStatus = mysqli_real_escape_string($con,$_POST['eventStatus']);
$q = mysqli_query($con,"update tblevents set fldEventName = '$eventName', fldEventType = '$eventType', fldEventVenue = '$eventVenue', fldEventDateTime = '$eventDateTime', fldNotes = '$eventNotes', fldCost = '$eventPrice', fldDownpayment = '0', fldStatus = '$eventStatus' where fldEventID = '$eventID'");
if($q)
echo "<script>alert('Event Details updated!');window.location='?p=events'</script>";
}
?>