SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | /* | |
3 | pertama.. targetnya blum km tentukan ke edit | |
4 | kedua.. targetnya tetap disini aja | |
5 | ketiga.. kl udah silakan komen die nya | |
6 | keempat. perhatikan array yg saya masukkan | |
7 | ||
8 | kelima.. jgn pake mysql_ pake pdo lebih bagus*/ | |
9 | ||
10 | if(count($_POST)>1){ | |
11 | die('<pre>'.print_r($_POST,1)); | |
12 | include "koneksi.php"; | |
13 | foreach($_POST['npm'] as $npm){ | |
14 | $absen=$_POST['absen'][$npm]; | |
15 | $tugas1=$_POST['tugas1'][$npm]; | |
16 | $tugas2=$_POST['tugas2'][$npm]; | |
17 | $tugas3=$_POST['tugas3'][$npm]; | |
18 | $nilai_ujian=$_POST['nilai_ujian'][$npm]; | |
19 | ||
20 | $sql="UPDATE mhsnilai SET absen='$absen',tugas1='$tugas1', tugas2='$tugas2', tugas3='$tugas3', nilai_ujian='$nilai_ujian'"; | |
21 | } | |
22 | ||
23 | }else{ | |
24 | //lanjutkan | |
25 | } | |
26 | ?> | |
27 | <html> | |
28 | ||
29 | <head> | |
30 | ||
31 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
32 | ||
33 | <title>Pengelola Nilai Mahasiswa</title> | |
34 | ||
35 | <link href="css/tooplate_style.css" rel="stylesheet" type="text/css" /> | |
36 | ||
37 | <script type="text/javascript" src="js/swfobject.js"></script> | |
38 | ||
39 | <script type="text/javascript"> | |
40 | ||
41 | var flashvars = {}; | |
42 | ||
43 | flashvars.xml_file = "photo_list.xml"; | |
44 | ||
45 | var params = {}; | |
46 | ||
47 | params.wmode = "transparent"; | |
48 | ||
49 | var attributes = {}; | |
50 | ||
51 | attributes.id = "slider"; | |
52 | ||
53 | swfobject.embedSWF("flash_slider.swf", "flash_grid_slider", "780", "210", "9.0.0", false, flashvars, params, attributes); | |
54 | ||
55 | </script> | |
56 | ||
57 | </head> | |
58 | ||
59 | <body> | |
60 | ||
61 | <div id="tooplate_wrapper"> | |
62 | ||
63 | <div id="tooplate_header"> | |
64 | ||
65 | <div id="tooplate_menu"> | |
66 | ||
67 | <ul> | |
68 | ||
69 | <li><a class="current">Saya Dosen</a></li> | |
70 | ||
71 | <li><a href="index.html" class="current">Logout</a></li> | |
72 | ||
73 | - | <form action="" method="get"> |
73 | + | |
74 | ||
75 | </div> <!-- end of tooplate_menu --> | |
76 | ||
77 | </div> <!-- end of forever header --> | |
78 | ||
79 | <div id="tooplate_middle"> | |
80 | ||
81 | <div id="flash_grid_slider"> | |
82 | ||
83 | <a rel="nofollow" href="http://www.adobe.com/go/getflashplayer"> | |
84 | ||
85 | <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> | |
86 | ||
87 | </a> | |
88 | ||
89 | </div> | |
90 | ||
91 | </div> <!-- end of middle --> | |
92 | ||
93 | <div id="tooplate_content"><span class="content_top"></span> | |
94 | ||
95 | <!-- dari sini logika loginnya--> | |
96 | ||
97 | <div class="cleaner h40"></div> | |
98 | ||
99 | <form action="" method="post"> | |
100 | ||
101 | <center> | |
102 | ||
103 | <h1>Edit Data Mahasiswa</h1> | |
104 | ||
105 | <table border="1" style="border-collapse:collapse" width="100%"> | |
106 | ||
107 | <tr style="background:orange;"> | |
108 | ||
109 | <!-- di gunakan untuk membuat label nama fieldnya--> | |
110 | ||
111 | <th>NPM</th> | |
112 | ||
113 | <th>Nama</th> | |
114 | ||
115 | <th>Kelas</th> | |
116 | ||
117 | <th>Absen</th> | |
118 | ||
119 | <th>Tugas 1</th> | |
120 | ||
121 | <th>Tugas 2</th> | |
122 | - | <td><?php echo $npm ?></td> |
122 | + | |
123 | <th>Tugas 3</th> | |
124 | ||
125 | <th>Nilai Ujian</th> | |
126 | ||
127 | <th>Grade</th> | |
128 | - | <td><center><input name='absen' placeholder="absen" size='4' maxlength='4' type=text value= '<?php echo $absen ?>'></center></td> |
128 | + | |
129 | </tr> | |
130 | - | <td><center><input name='tugas1' placeholder="tugas1" size='4' maxlength='4' type=text value='<?php echo $tugas1 ?>'></center></td> |
130 | + | |
131 | ||
132 | - | <td><center><input name='tugas2' placeholder='tugas2' size='4' maxlength='4' type=text value='<?php echo $tugas2 ?>'></center></td> |
132 | + | |
133 | ||
134 | - | <td><center><input name='tugas3' placeholder='tugas3' size='4' maxlength='4' type=text value='<?php echo $tugas3 ?>'></center></td> |
134 | + | |
135 | ||
136 | - | <td><center><input name='nilai_ujian' placeholder='nilai_ujian' size='5' maxlength='5' type=text value='<?php echo $nilai_ujian?>'></center></td> |
136 | + | |
137 | ||
138 | $result=mysqli_query($conn,$sql) or die(mysqli_error()); | |
139 | ||
140 | while ($row=mysqli_fetch_array($result)) { | |
141 | ||
142 | extract($row); | |
143 | ||
144 | ?> | |
145 | ||
146 | <tr> | |
147 | ||
148 | <td><?php echo $npm ?><input type=hidden name=npm[] value='<?php echo $npm;?>' /></td> | |
149 | ||
150 | <td><?php echo $nama ?></td> | |
151 | ||
152 | <td><?php echo $kelas ?></td> | |
153 | ||
154 | <td><center><input name='absen[<?php echo $npm;?>]' placeholder="absen" size='4' maxlength='4' type=text value= '<?php echo $absen ?>'></center></td> | |
155 | ||
156 | <td><center><input name='tugas1[<?php echo $npm;?>]' placeholder="tugas1" size='4' maxlength='4' type=text value='<?php echo $tugas1 ?>'></center></td> | |
157 | ||
158 | <td><center><input name='tugas2[<?php echo $npm;?>]' placeholder='tugas2' size='4' maxlength='4' type=text value='<?php echo $tugas2 ?>'></center></td> | |
159 | ||
160 | <td><center><input name='tugas3[<?php echo $npm;?>]' placeholder='tugas3' size='4' maxlength='4' type=text value='<?php echo $tugas3 ?>'></center></td> | |
161 | ||
162 | <td><center><input name='nilai_ujian[<?php echo $npm;?>]' placeholder='nilai_ujian' size='5' maxlength='5' type=text value='<?php echo $nilai_ujian?>'></center></td> | |
163 | ||
164 | <td><center><?php echo $grade ?></center></td> | |
165 | ||
166 | </tr> | |
167 | ||
168 | <?php | |
169 | ||
170 | } | |
171 | ||
172 | ?> | |
173 | ||
174 | </table> | |
175 | ||
176 | </center> | |
177 | ||
178 | </form> | |
179 | ||
180 | <center> | |
181 | ||
182 | <p>||<a href="update.php">Simpan</a>||</p> | |
183 | ||
184 | </center> | |
185 | ||
186 | <div class="cleaner"></div> | |
187 | ||
188 | </div> <!-- end of content --> | |
189 | ||
190 | <div id="tooplate_footer"> | |
191 | ||
192 | Copyright © 2048 <a href="#">Company Name</a> | |
193 | ||
194 | <div class="cleaner"></div> | |
195 | ||
196 | </div> | |
197 | ||
198 | </div> <!-- end of wrapper --> | |
199 | ||
200 | </body> | |
201 | ||
202 | </html> |