forked from khanhdnk/akathon01-23
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatedevices.php
34 lines (32 loc) · 899 Bytes
/
updatedevices.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
<?php
include('./conn/func.php');
if (
isset($_POST['name']) &&
isset($_POST['port']) &&
isset($_POST['bandwidth']) &&
isset($_POST['price']) &&
isset($_POST['size']) &&
isset($_POST['weight'])
) {
$ndata = [
"id" => uuid(),
"name" => $_POST['name'],
"image" => "images/placeholder.png",
"link" => "https://www.cisco.com/site/us/en/products/networking/switches/index.html",
"port" => $_POST['port'],
"bandwidth" => $_POST['bandwidth'],
"price" => $_POST['price'],
"size" => $_POST['size'],
"weight" => $_POST['weight']
];
$showndata = postData("devices", $ndata);
echo $showndata;
header('Location: ./admin.php#scroll');
}
if (isset($_GET['device_id'])) {
$deleteid = $_GET['device_id'];
$delete = deleteData("devices", $deleteid);
echo $delete;
header('Location: ./admin.php#scroll');
}
?>