Pemrograman Web 2. Modul 8. Form Lembar Hasil Studi (LHS) dengan menggunakan PHP

1. Formlhs.html


<html>
<body>
<h3>Form Lembar Hasil Studi</h3>
<table border=1>
<form method=post action="tampillhs.php">
<tr><td>
No BP    </td><td>=<input type=text name="nobp"</td></tr>
<tr><td>
Semester </td><td>=<input type=text name="semester"</td></tr>
<tr><td>
Tahun    </td><td>=<input type=text name="tahun"</td></tr>
<tr><td>
<input type =submit value="OK">
<input type=reset value ="Cancel"></td></tr>
</form>
</body>
</html>

2. Tampillhs.php


<?php
include"konek.php";

$nobp= $_POST['nobp'];
$semester= $_POST['semester'];
$tahun = $_POST['tahun'];

$krssql = mysql_query("select * from krs where nobp='$nobp'
 AND semester='$semester' AND tahun='$tahun'");
$hasil=mysql_num_rows($krssql);
if($hasil > 0 )
{
$mhssql = mysql_query("select * from mhs where nobp='$nobp'");
$hasilmhs=mysql_fetch_row($mhssql);
if ($hasilmhs)
{
echo"<table border=1>";
echo"<tr><td colspan=7>NOBP : $nobp<br>";
echo"Nama : $hasilmhs[1]<br>";
echo"Semester : $semester<br>";
echo"Tahun : $tahun<br></td></tr>";
}
}
?>

<tr>  <th>No.</th>
 <th>Kode</th>
 <th>Nama Matakuliah</th>
 <th>SKS</th>
 <th>Nilai</th>
 <th>Mutu</th>
 <th>Bobot Mutu</th>
</tr>
<?php
$sqlkrs = mysql_query("SELECT * FROM krs, mtk WHERE nobp='$nobp'
 AND krs.kodemk = mtk.kode
 AND krs.semester='$semester' AND krs.tahun='$tahun'");
$jumsks = 0;
$i = 1;
$totbot=0;
while($datakrs = mysql_fetch_array($sqlkrs)){
 echo "<tr><td>$i</td>";
 echo "<td>$datakrs[kode]</td>";
 echo "<td>$datakrs[nama]</td>";
 echo "<td>$datakrs[sks]</td>";
 echo "<td>$datakrs[Nilai]</td>";
 if ($datakrs['Nilai']=="A")
 $mutu=4;
 else if ($datakrs['Nilai']=="B")
 $mutu=3;
 else if ($datakrs['Nilai']=="C")
 $mutu=2;
 else if ($datakrs['Nilai']=="D")
 $mutu=1;
 else
 $mutu=0;
 echo "<td>$mutu</td>";
 $bobotmutu = $datakrs['sks'] * $mutu;
 echo "<td>$bobotmutu</td>";
 $jumsks = $jumsks + $datakrs['sks'];
 $totbot = $totbot + $bobotmutu;
 $i++;
}
echo "<tr><td colspan=6>JUMLAH SKS</td><td>$jumsks</td></tr>";
echo "<tr><td colspan=6>JUMLAH Bobot</td><td>$totbot</td></tr>";
$ipk = $totbot / $jumsks;
echo "<tr><td colspan=6>IPK</td><td>$ipk</td></tr>";
?>
</table>

 

3.  Tampildosen.php


<?php
include "konek.php";
$tampil="select * from dosen";
$hasil=mysql_query($tampil);
echo"<table border=1>";
echo"Daftar Dosen";
echo"<tr><th>No. </th>
 <th>Kode Dosen </th>
 <th>Nama Dosen </th>
 <th>Alamat Dosen </th></tr>";
$nomor=1;
while($data=mysql_fetch_row($hasil))
{
echo "<tr><td>$nomor</td>";
echo "<td>$data[0]</td>";
echo "<td>$data[1]</td>";
echo "<td>$data[2]</td>";
$nomor++;
}
echo"</table>";
?>

 

Materi yang berhubungan :

1. Aplikasi Sistem Informasi Akademik
2. Form MAhasiswa
3. Form Dosen
4. Form Matakuliah
5. Jadwal Perkuliahan"
6. Form KRS
7. Form Nilai
8. Form LHS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: