Ads 720 x 90

Tugas Membuat Nilai Siswa (Web Design)

1. Membuat database
Contoh : ade_11080965

2. Membuat tabel
Contoh : nilai_siswa

Isi field seperti gambar dibawah ini :



3.lalu buatlah tampilan inputan untuk Nilai Siswa :
Listing :


<body>
<form name="form1" method="post" action="data_nilai.php">
<table width="75%">
<tr>
<td width="23%">Nim</td>
<td width="7%">
<div align="center">:</div></td>
<td width="70%">
<input name="nim" type="text" id="nim"></td>
</tr>
<tr>
<td>Nama</td>
<td><div align="center">:</div></td>
<td><input name="nama" type="text" id="nama"></td>
</tr>
<tr>
<td>MataKuliah</td>
<td><div align="center">:</div></td>
<td><select name="matkul">
<option>webpro</option>
<option>logika</option>
<option>sisfo</option>
</select></td>
</tr>
<tr>
<td>UTS</td>
<td><div align="center">:</div></td>
<td><input name="uts" type="text" id="uts"></td>
</tr>
<tr>
<td>UAS</td>
<td><div align="center">:</div></td>
<td><input name="uas" type="text" id="uas"> </td>
</tr>
<tr>
<td>TUGAS</td>
<td><div align="center">:</div></td>
<td><input name="tugas" type="text" id="tugas"></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input name="proses" type="submit" id="proses" value="proses">
<input name="simpan" type="submit" id="simpan" value="simpan">
<input name="batal" type="reset" id="batal" value="batal">
</div></td>
</tr>
</table>
</form>
</body>


4. Buat koneksi ke database

Listing koneksi :

<?php
$host='localhost';
$user='root';
$pass='password';
$db='ade_11080965';
$ok=mysql_connect($host,$user,$pass) or die ('gagal konek'.mysql_error());
mysql_select_db($db,$ok);
?>


5. Buat Perintah SQL untuk penyimpanan ke database

Listing :

<body>
<?
include "koneksi.php";
$id_nilai=$_post["id_nilai"];
$nim=$_post["nim"];
$nama=$_post["nama"];
$uts=$_post["uts"];
$uas=$_post["uas"];
$tugas=$_post["tugas"];
$total=$_post["total"];
$grade=$_post["grade"];
$input="insert into
nilai_siswa(id_nilai,nim,nama,uts,uas,tugas,total,grade)value('$id_nilai','$nim','$nama','$uts','$uas','$tugas','$total','$grade')";
$query=mysql_query($input);
if($query)
{
echo"<pre>id_nilai : $id_nilai</pre>";
echo"<pre>nim : $nim</pre>";
echo"<pre>nama : $nama</pre>";
echo"<pre>uts : $uts</pre>";
echo"<pre>uas : $uas</pre>";
echo"<pre>tugas : $tugas</pre>";
echo"<pre>total : $total</pre>";
echo"<pre>grade : $grade</pre><br>";
echo"Data Diatas Telah Sukses Tersimpan<br>";
echo"<a href=data_nilai.php>[browse data]</a>";
}
else
{
echo "gagal tersimpan" <br>
echo "<a href=input_nilai.php[input data]</a>";
}
?>
</body>


6. Buat design untuk menampilkannya :

<body>
<?
include "koneksi.php";
$perintah="select *from nilai_siswa";
$hasil=mysql_query($perintah);
while($row=mysql_fetch_array($hasil)
{
$id_nilai=$row[id_nilai];
$nim=$row[nim];
$nama=$row[nama];
$matkul=$row[matkul];
$uts=$row[uts];
$uas=$row[uas];
$tugas=$row[tugas];
$total=$row[total];
$grade=$row[grade];
}
{
echo"<pre>id_nilai :$id_nilai</pre>";
echo"<pre>nim :$nim</pre>";
echo"<pre>nama :$nama</pre>";
echo"<pre>matku :$matkul</pre>";
echo"<pre>uts :$uts</pre>";
echo"<pre>uas :$uas</pre>";
echo"<pre>tuagas :$tugas</pre>";
echo"<pre>total :$total</pre>";
echo"<pre>grade :$grade</pre><br>";
}
echo"<a href=input_nilai.php>back</a>";
?>
</body>


Selesai..

Related Posts

Posting Komentar