Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /************************
- created by : CAHYA DSN
- created date : 2013-01-02
- status : not tested
- *************************/
- //collecting data from previous POST
- $nis =isset($_POST['isi'])?$_POST['isi']:'';
- $nip =isset($_POST['nip'])?$_POST['nip']:'';
- $isi =isset($_POST['namakepala'])?$_POST['namakepala']:'';
- $periode =isset($_POST['thn'])?$_POST['thn']:'';
- $tahunajaran=isset($_POST['tahunajaran'])?$_POST['tahunajaran']:'';
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Data Nilai</title>
- <style type="text/css">
- body,table {font-family:arial,verdana, sans-serif; font-size:10pt;}
- .left {float:left;}
- .right {float:right;}
- .clear {clear:both;}
- .label {width:150px;font-weight:normal;}
- .colon {width:40px;}
- .data {width:150px;font-weight:bold;}
- .header_sekolah {font-size:14pt;width:100%;}
- .header_judul {font-size:18pt;width:100%;}
- .container {width:100%;}
- .dark {background-color:#eee;}
- .light {background-color:#fff;}
- </style>
- </head>
- <body>
- <?php
- if($nis){
- include("../library/koneksi.php");
- ?>
- <div class="header_sekolah">
- MADRASAH TSANAWIAH NEGERI SUBANG ANAK<br />
- KABUPATEN TANAH DATAR<br />
- JL. RAYA PADANG PANJANG - SOLOK
- </div>
- <div class="header_judul">DATA NILAI</div>
- <?php
- $sql="SELECT namasiswa, kelas FROM siswa WHERE nis = '".$nis."'";
- $query = mysql_query($sql)or die ("Query failed with error: ".mysql_error());
- $data = mysql_fetch_array($query);
- ?>
- <div class="container">
- <div class="label left">NISN</div>
- <div class="colon left">:</div>
- <div class="data left"><?php echo $nis;?></div>
- <div class="label right">Tahun Ajaran :</div>
- <div class="data right"><?php echo $tahunajaran; ?></div>
- <div class="clear"></div>
- <div class="label left">Nama Siswa</div>
- <div class="colon left">:</div>
- <div class="data left"><?php echo $data['namasiswa'];?></div>
- <div class="clear"></div>
- <div class="label left">Kelas</div>
- <div class="colon left">:</div>
- <div class="data left"><?php echo $data['kelas'];?></div>
- <div class="clear"></div>
- <div class="datagrid">
- <table width="100%" border="0">
- <?php
- $sql="SELECT n.nis, n.kodematapelajaran, n.nilaiMID, n.nilaiUAS, mp.namamatapelajaran, mp.semester
- FROM nilai n,matapelajaran mp
- WHERE n.kodematapelajaran=mp.kodematapelajaran
- AND n.nis = '".$nis."'
- ORDER BY mp.semester";
- $query = mysql_query($sql)or die ("Query failed with error: ".mysql_error());
- if(mysql_num_rows($query)){
- $i=0;
- $semester=0;
- while ($data = mysql_fetch_array($query)){
- if($semester!=$data['semester']){
- $semester=$data['semester'];
- echo "<tr><th colspan=\"5\"> SEMESTER $semester</th></tr>\n"
- ."<tr>\n"
- ."<th>KODE MATAPELAJARAN</th>\n"
- ."<th>NAMA MATAPELAJARAN</th>\n"
- ."<th>SEMESTER</th>\n"
- ."<th>NILAI MID</th>\n"
- ."<th>NILAI UAS</th>\n"
- ."</tr>\n";
- }
- ?>
- <tr class="<?php echo $i%2==0?"dark":"light";?>">
- <td><?php echo $data['kodematapelajaran'];?></td>
- <td><?php echo $data['namamatapelajaran'];?></td>
- <td><?php echo $data['semester'];?></td>
- <td><?php echo $data['nilaiMID'];?></td>
- <td><?php echo $data['nilaiUAS'];?></td>
- </tr>
- <?php
- }// end while
- echo "<tr>\n"
- ."<td colspan=\"5\">\n"
- ."<a href=\"semua.php?page=cetak&nis=".$nis."&isi=".$isi."&nip=".$nip."&tahunajaran=".$tahunajaran."\" target=\"_blank\">\n"
- ."<img src=\"images/Printer1.png\" title=\"PRINT NILAI\"/>\n"
- ."</a></td></tr>\n";
- }else{
- echo "<tr><td colspan=\"5\">Data Not Found</td></tr>\n";
- }
- ?>
- </table>
- </div> <!-- container -->
- <?php
- } else{
- echo "please provide correct 'NIS' number";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement