-
Notifications
You must be signed in to change notification settings - Fork 1
/
kriteria_edit.php
166 lines (140 loc) · 7.22 KB
/
kriteria_edit.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
<?php
include "koneksi.php";
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sistem Pendukung Keputusan SAW</title>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">SMARTPHONE CHOICER
</a>
</div>
<div class="notifications-wrapper">
</div>
</nav>
<!-- /. NAV TOP -->
<nav class="navbar-default navbar-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<li>
<div class="user-img-div">
<img src="assets/img/adam.jpg" class="img-circle" />
</div>
</li>
<li>
<a href="#"> <strong> Muhammad Adam </strong></a>
</li>
<li>
<a href="index.php"><i class="fa fa-dashboard "></i>Dashboard</a>
</li>
<li>
<a href="alternatif.php"><i class="fa fa-venus "></i>Alternatif</a>
</li>
<li>
<a class="active-menu" href="kriteria.php"><i class="fa fa-bolt "></i>Kriteria</a>
</li>
<li>
<a href="subkriteria.php"><i class="fa fa-code "></i>Sub Kriteria</a>
</li>
<li>
<a href="normalisasi.php"><i class="fa fa-dashcube "></i>Normalisasi</a>
</li>
<li>
<a href="perhitungan.php"><i class="fa fa-dashcube "></i>Perhitungan</a>
</li>
<li>
<a href="kesimpulan.php"><i class="fa fa-dashcube "></i>Kesimpulan</a>
</li>
</ul>
</div>
</nav>
<div id="page-wrapper" class="page-wrapper-cls">
<div id="page-inner">
<div class="row">
<div class="col-md-12">
<h1 class="page-head-line">Edit Kriteria</h1>
</div>
</div>
<?php
// Check If form submitted, insert form data into users table.
if(isset($_POST['update'])) {
$id = $_POST['id_kriteria'];
$name = $_POST['nama_kriteria'];
$att = $_POST['attribut'];
// include database connection file
include_once("koneksi.php");
// Insert user data into table
$result = mysql_query("UPDATE kriteria SET nama_kriteria='$name', attribut='$att' WHERE id_kriteria=$id");
// Show message when user added
echo "<script type=text/javascript>
window.location.href='http://localhost/sawhp/kriteria.php';
</script>";
}?>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
Form Edit Kriteria
</div>
<div class="panel-body">
<?php
$id_kriteria = $_GET['id_kriteria'];
$result = mysql_query("SELECT * FROM kriteria WHERE id_kriteria='$id_kriteria'") or die (mysql_error());
$data = mysql_fetch_array($result);
?>
<form action="kriteria_edit.php" method="post" name="form1">
<table width="25%" border="0">
<div class="form-group">
<input type="hidden" class="form-control" name="id_kriteria" value="<?php echo $data['id_kriteria'];?>" placeholder="Id" />
</div>
<div class="form-group">
<label>Nama Kriteria</label>
<input type="text" class="form-control" name="nama_kriteria" value="<?php echo $data['nama_kriteria'];?>" placeholder="Nama Kriteria" />
</div>
<div class="form-group">
<label>Attribut</label><br>
<div class="radio">
<div class="col-md-6">
<input type="radio" name="attribut" value="Cost" <?php if ($data["attribut"]=="Cost"){?> checked="checked" <?php } ?> />
Cost <br>
<input type="radio" name="attribut" value="Benefit" <?php if ($data["attribut"]==="Benefit"){ ?> checked="checked" <?php } ?> />
Benefit
</div>
</div>
</div>
<tr>
<td></td>
<td><input type="submit" name="update" value="Update" class="btn btn-primary btn-sm"></td>
<td><a href="kriteria.php" value="Cancel" class="btn btn-danger btn-sm">Cancel</a></td>
</tr>
</table>
</form>
</div>
<!-- /. PAGE INNER -->
</div>
</div>
</div>
</div>
<footer>
© 2018 Poltekpos | By : <a href="#" target="_blank">Muhammad Adam Nahdlotul Halimi</a>
</footer>
<script src="assets/js/jquery-1.11.1.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/jquery.metisMenu.js"></script>
<script src="assets/js/custom.js"></script>
</body>
</html>