-
Notifications
You must be signed in to change notification settings - Fork 0
/
updatestokbarangAct.php
173 lines (160 loc) · 7.44 KB
/
updatestokbarangAct.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
<?php
include 'database.php';
session_start();
if (@$_SESSION['username'] == '') {
echo "<script>
alert('Silahkan Login Dahulu...')
window.location='loginhrd.php';
</script>";
}
if(isset($_POST['update']))
{
$id = mysqli_real_escape_string($conn, $_POST['id']);
$kode = mysqli_real_escape_string($conn, $_POST['kode']);
$nama = mysqli_real_escape_string($conn, $_POST['nama']);
$jenis = mysqli_real_escape_string($conn, $_POST['jenis']);
$pemasukan = mysqli_real_escape_string($conn, $_POST['pemasukan']);
$pengeluaran = mysqli_real_escape_string($conn, $_POST['pengeluaran']);
//updating the table
$result = mysqli_query($conn, "UPDATE tb_barang SET kode_barang='$kode',nama_barang='$nama',jenis_barang='$jenis',pemasukan='$pemasukan',pengeluaran='$pengeluaran' WHERE id=$id");
if($result){
header("Location: updatestokbarang.php");
}
//redirectig to the display page. In our case, it is index.php
}
?>
<?php
//getting id from url
$id = $_GET['id'];
//selecting data associated with this particular id
$result = mysqli_query($conn, "SELECT * FROM tb_barang WHERE id=$id");
while($res = mysqli_fetch_array($result))
{
$kode = $res['kode_barang'];
$nama = $res['nama_barang'];
$jenis = $res['jenis_barang'];
$pemasukan = $res['pemasukan'];
$pengeluaran = $res['pengeluaran'];
}
?>
<!DOCTYPE html>
<html lang="en">
<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>Update Stok Barang</title>
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/ruang-admin.min.css" rel="stylesheet">
</head>
<body id="page-top">
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav sidebar sidebar-light accordion" id="accordionSidebar">
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
<div class="sidebar-brand-icon">
</div>
<div class="sidebar-brand-text mx-3">HRD</div>
</a>
<hr class="sidebar-divider my-0">
<li class="nav-item active">
<a class="nav-link" href="homehrd.php">
<i class="fas fa-fw fa-tachometer-alt"></i>
<span>Home</span></a>
</li>
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="inputdatametal.php">
<i class="fas fa-fw fa-chart-area"></i>
<span>Input Data Metal</span>
</a>
</li>
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="inputstockbarang.php">
<i class="fas fa-fw fa-store"></i>
<span>Input Stok Barang</span>
</a>
</li>
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="updatestokbarang.php">
<i class="fas fa-fw fa-check"></i>
<span>Update Stok Barang</span>
</a>
</li>
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="logout.php">
<i class="fas fa-fw fa-closed-captioning"></i>
<span>Logout</span>
</a>
</li>
</ul>
<!-- Sidebar -->
<div id="content-wrapper" class="d-flex flex-column">
<div id="content">
<!-- TopBar -->
<nav class="navbar navbar-expand navbar-light bg-navbar topbar mb-4 static-top">
<button id="sidebarToggleTop" class="btn btn-link rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<ul>
<li>
<h3 style="color: aliceblue; margin-left: 5rem; margin-top: 1rem;">SISTEM INFORMASI
INVENTORY BARANG METAL</h3>
</li>
</ul>
</nav>
<!-- Topbar -->
<div class='text-center'>
<span><b>Update</b> Stok Barang</span>
</div>
<div style="margin:1rem; text-align:center; justify-content:center;">
<form method="POST" name="form1">
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Kode Barang</label>
<input type="text" class="form-control" id="exampleFormControlInput1" name="kode"
value="<?php echo $kode?>">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nama Barang</label>
<input type="text" class="form-control" id="exampleFormControlInput1" name="nama"
value="<?php echo $nama?>">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Jenis Barang</label>
<input type="tex" class="form-control" id="exampleFormControlInput1" name="jenis"
value="<?php echo $jenis?>">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Pemasukan</label>
<input type="tex" class="form-control" id="exampleFormControlInput1" name="pemasukan"
value="<?php echo $pemasukan?>">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Pengeluaran</label>
<input type="tex" class="form-control" id="exampleFormControlInput1" name="pengeluaran"
value="<?php echo $pengeluaran?>">
</div>
<div class="mb-3">
<input type="hidden" name="id" value=<?php echo $_GET['id'];?>>
<input type="submit" class='btn btn-outline-success' name="update" value="Update">
</div>
</form>
</div>
<!-- Scroll to top -->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="js/ruang-admin.min.js"></script>
<script src="vendor/chart.js/Chart.min.js"></script>
<script src="js/demo/chart-area-demo.js"></script>
</body>
</html>