-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
107 lines (79 loc) · 4.13 KB
/
edit.php
File metadata and controls
107 lines (79 loc) · 4.13 KB
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
<?php
require 'db_connect.php';
session_start();
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>LEYECO V HELIOS</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>SB Admin - Tables</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin.css" rel="stylesheet">
</head>
<body>
<?php
if(isset($_GET["edit"])){
$id = $_GET["edit"];
date_default_timezone_set('Asia/Manila');
$edit = "SELECT * from tbl_primary WHERE world_id=$id";
$edit_query = $conn->query($edit);
while ($row = $edit_query->fetch_assoc()){
$name = $row["name"];
$latitude = $row["latitude"];
$longitude = $row["longitude"];
$date_updated = date('m/d/Y h:i A');
}
}
if(isset($_POST["update"])){
$id = $_GET["edit"];
$name = $_POST["name"];
$latitude = $_POST["latitude"];
$longitude = $_POST["longitude"];
$update = "UPDATE tbl_world SET name='$name', latitude='$latitude', longitude='$longitude', date_updated='$date_updated' WHERE world_id=$id";
$update_query = $conn->query($update);
echo "<script> alert('Update success')</script>";
header("location:database.php");
}
else if(isset($_POST["close"])){
header("location:database.php");
}
?>
<center>
<form form="edit.php" method="POST">
<div class="card-body">
<input type="text" name="name" value="<?php echo $name; ?>">
</div>
<div class="card-body">
<input type="text" name="latitude" value="<?php echo $latitude; ?>">
</div>
<div class="card-body">
<input type="text" name="longitude" value="<?php echo $longitude; ?>">
</div>
<div>
<button type="submit" name="close" class="btn btn-danger btn-xs remove">Close</button>
<button type="submit" name="update" class="btn btn-success btn-xs remove">Save Changes</button>
</div>
</center>
</form>
</body>
</html>