-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit-alternatif.php
167 lines (155 loc) · 8.53 KB
/
edit-alternatif.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
<?php
session_start();
include('configdb.php');
?>
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title><?php echo $_SESSION['judul']." - ".$_SESSION['by'];?></title>
<!-- Bootstrap core CSS -->
<!--link href="ui/css/bootstrap.css" rel="stylesheet"-->
<link href="ui/css/cerulean.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="ui/css/jumbotron.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!--script src="./index_files/ie-emulation-modes-warning.js"></script-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Static navbar -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#"><?php echo $_SESSION['judul'];?></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="kriteria.php">Data Kriteria</a></li>
<li><a href="alternatif.php">Data Alternatif</a></li>
<li><a href="analisa.php">Analisa</a></li>
<li><a href="perhitungan.php">Perhitungan</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<div class="container">
<!-- Main component for a primary marketing message or call to action -->
<div class="panel panel-primary">
<!-- Default panel contents -->
<div class="panel-heading">Edit Data Alternatif</div>
<?php
$kriteria = $mysqli->query("select * from kriteria");
if(!$kriteria){
echo $mysqli->connect_errno." - ".$mysqli->connect_error;
exit();
}
$i=0;
while ($row = $kriteria->fetch_assoc()) {
@$k[$i] = $row["kriteria"];
$i++;
}
$result = $mysqli->query("select * from alternatif where id_alternatif = ".$_GET['id']."");
if(!$result){
echo $mysqli->connect_errno." - ".$mysqli->connect_error;
exit();
}
while($row = $result->fetch_assoc()){
?>
<div class="panel-body">
<form role="form" method="post" action="edit.php?id=<?php echo $_GET['id'];?>">
<div class="box-body">
<div class="form-group">
<label for="alternatif">Alternatif</label>
<input type="text" class="form-control" name="alternatif" id="alternatif" value="<?php echo $row["alternatif"];?>" placeholder="Jenis Kayu">
</div>
<div class="form-group">
<label for="k1"><?php echo ucwords($k[0]);?></label>
<select class="form-control" name="k1" id="k1">
<option value='1' <?php if($row["k1"]=='1') echo "selected"?>>1</option>
<option value='2' <?php if($row["k1"]=='2') echo "selected"?>>2</option>
<option value='3' <?php if($row["k1"]=='3') echo "selected"?>>3</option>
<option value='4' <?php if($row["k1"]=='4') echo "selected"?>>4</option>
<option value='5' <?php if($row["k1"]=='5') echo "selected"?>>5</option>
</select>
</div>
<div class="form-group">
<label for="k2"><?php echo ucwords($k[1]);?></label>
<select class="form-control" name="k2" id="k2">
<option value='1' <?php if($row["k2"]=='1') echo "selected"?>>1</option>
<option value='2' <?php if($row["k2"]=='2') echo "selected"?>>2</option>
<option value='3' <?php if($row["k2"]=='3') echo "selected"?>>3</option>
<option value='4' <?php if($row["k2"]=='4') echo "selected"?>>4</option>
<option value='5' <?php if($row["k2"]=='5') echo "selected"?>>5</option>
</select>
</div>
<div class="form-group">
<label for="k3"><?php echo ucwords($k[2]);?></label>
<select class="form-control" name="k3" id="k3">
<option value='1' <?php if($row["k3"]=='1') echo "selected"?>>1</option>
<option value='2' <?php if($row["k3"]=='2') echo "selected"?>>2</option>
<option value='3' <?php if($row["k3"]=='3') echo "selected"?>>3</option>
<option value='4' <?php if($row["k3"]=='4') echo "selected"?>>4</option>
<option value='5' <?php if($row["k3"]=='5') echo "selected"?>>5</option>
</select>
</div>
<div class="form-group">
<label for="k4"><?php echo ucwords($k[3]);?></label>
<select class="form-control" name="k4" id="k4">
<option value='1' <?php if($row["k4"]=='1') echo "selected"?>>1</option>
<option value='2' <?php if($row["k4"]=='2') echo "selected"?>>2</option>
<option value='3' <?php if($row["k4"]=='3') echo "selected"?>>3</option>
<option value='4' <?php if($row["k4"]=='4') echo "selected"?>>4</option>
<option value='5' <?php if($row["k4"]=='5') echo "selected"?>>5</option>
</select>
</div>
<div class="form-group">
<label for="k5"><?php echo ucwords($k[4]);?></label>
<select class="form-control" name="k5" id="k5">
<option value='1' <?php if($row["k5"]=='1') echo "selected"?>>1</option>
<option value='2' <?php if($row["k5"]=='2') echo "selected"?>>2</option>
<option value='3' <?php if($row["k5"]=='3') echo "selected"?>>3</option>
<option value='4' <?php if($row["k5"]=='4') echo "selected"?>>4</option>
<option value='5' <?php if($row["k5"]=='5') echo "selected"?>>5</option>
</select>
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<button type="reset" class="btn btn-info">Reset</button>
<a href="alternatif.php" type="cancel" class="btn btn-warning">Batal</a>
<button type="submit" class="btn btn-primary">Proses Edit</button>
</div>
</form>
<?php
}
?>
</div>
<div class="panel-footer text-primary"><?php echo $_SESSION['by'];?><div class="pull-right"></div></div>
</div>
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="ui/js/jquery-1.10.2.min.js"></script>
<script src="ui/js/bootstrap.min.js"></script>
<script src="ui/js/bootswatch.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="ui/js/ie10-viewport-bug-workaround.js"></script>
</body></html>