-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.php
57 lines (50 loc) · 1.8 KB
/
store.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
<?php
include_once('core.php');
if (!isset($_SESSION['userEmail'])) {
header('Location: /login.php');
}
if ($_SERVER['REQUEST_METHOD'] =='POST') {
$request = $_POST;
$store = new StoreController;
$store = $store->update($request, $_GET['id']);
if ($store ==1) {
$message = message(1,'Store updated successfully!');
}
}
if (!isset($_GET['id']) || empty($_GET['id'])) {
header('Location: /accessControl.php');
} else {
$store = new StoreController;
$store = $store->view($_GET['id']);
if (!is_array($store)) {
header('Location: /accessControl.php');
}
$pageTitle = 'Edit - '.$store['name'];
include 'header.php';
if (isset($message)) {
echo "$message";
}
?>
<div class="contact-form sm-res-mg-t-30 tb-res-mg-t-30 tb-res-mg-t-0">
<div class="contact-hd sm-form-hd">
<h2>Edit User</h2>
</div>
<form method="post">
<div class="contact-form-int">
<div class="form-group">
<div class="form-single nk-int-st widget-form">
<input type="text" name="name" class="form-control" value="<?php echo $store['name']; ?>">
</div>
</div>
<div class="form-group">
<div class="form-single nk-int-st widget-form">
<textarea name="address" class="form-control" placeholder="Address"><?php echo $store['address']; ?></textarea>
</div>
</div>
<div class="contact-btn">
<button class="button btn waves-effect">Save</button> <a href="/stores.php" class="button btn waves-effect">Cancel</a>
</div>
</div>
</form>
</div>
<?php } include 'footer.php'; ?>