-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditceking.php
More file actions
34 lines (27 loc) · 892 Bytes
/
Copy patheditceking.php
File metadata and controls
34 lines (27 loc) · 892 Bytes
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
ob_start();
//koneksi
include("../konfig.php");
// cek tombol simpan apakah sudah diklik
if(isset($_POST['simpan'])){
// mengambil data dari method kevariabel
$id = $_POST['id'];
$merk = $_POST['merk'];
$deskripsi = $_POST['deskripsi'];
$jumlah = $_POST['jumlah'];
$harga = $_POST['harga'];
// data yang didapat dijadikan query
$sql = "UPDATE hp SET merk='$merk', deskripsi='$deskripsi' , jumlah='$jumlah', harga='$harga' WHERE id=$id";
$query = mysqli_query($db, $sql);
// cek update apakah berhasil?
if( $query ) {
// kalau berhasil alihkan ke halaman index.php dengan status=success
header('Location: index.php?status=success');
} else {
// kalau gagal alihkan ke halaman indek.php dengan status=fail
header('Location: index.php?status=fail');
}
} else {
die("Akses dilarang...");
}
?>