====Daftarbarang.php
<?
include "koneksi.php";
$qry=mysql_query("select*from barang");
echo"<table border='1px' width='500px'>
<tr>
<th>No</th>
<th>kode_barang</th>
<th> barang </th>
<th> harga </th>
<th> spesifikasi </th>
<th>Aksi</th>
</tr>";
while($r=mysql_fetch_array($qry)){
echo"<tr>
<td>$No</td>
<td>$r[kode_barang] </td>
<td>$r[barang]</td>
<td>$r[harga] </td>
<td>$r[spesifikasi] </td>
<td><a href='formeditbarang.php?ID=$r[kodebrg]'>Edit</a></td>
</tr>";
}
echo"</table>";
?>
===form barang.php
<table border="1px" width="500px">
<tr>
<th colspan="2">:FORM BARANG:</th>
</tr>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="xkdbarang" size="30" maxlenght"10" value=""/></td>
</tr>
<tr>
<td>Barang</td>
<td><input type="text" name="xbarang" size="30" maxlenght"30" value=""/></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="xharga" size="30" maxlenght"30" value=""/></td>
</tr>
<tr>
<td>Spesifikasi</td>
<td><textarea name="xspesifikasi" rows="3" cols="10"></textarea></td>
</tr>
<tr>
<th><input type="submit" name="Simpan" value="Simpan"/></th>
<th><input type="reset" name="reset" value="Batal"/></th>
</tr>
</table>
</from>
===Form edit barang.php
<?
include"koneksi. . php";
$r=mysql_fetch_array(mysql_query)("select * from barang where kodebrg='$_REQUEST[ID]'"));
?>
<form action="simpaneditbarang.php"method="POST">
<table border="1px" width="500px">
<tr>
<th colspan="2">:FORM BARANG:</th>
</tr>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="xkdbarang" size="30" maxlength="10" value="<? echo"$r[kodebrg]";?/>"/></td>
</tr>
<tr>
<td>Barang</td>
<td><input type="text" name="xbarang" size="30" maxlength="30" value="<? echo"$r[barang]";?/>"/></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="xharga" size="30" maxlenght"30" value="<? echo"$r[harga]";?/>"/></td>
</tr>
<tr>
<td>Spesifikasi</td>
<td><textarea name="xspesifikasi" rows="3" cols="10">
<? echo"$r[Spesifikasi]";?/>
</textarea></td>
</tr>
<tr>
<td>Simpan</td>
<td><input type="submit/reset" name="Update" value="cancel"/></td>
</tr>
</table>
==index.php
<center>
<form action="simpan.php"method="post">
<table>
<tr><td>Nis</td>
<td>:</td>
<td><input type="text"name="Nis">
</td></tr>
<tr><td>Nama</td>
<td>:</td>
<td><input type="text"name="Nama">
</td></tr>
<tr><td>Telepon</td>
<td>:</td>
<td><input type="text"name="Telepon">
</td></tr>
<tr><td colspan="3"align="center">
<input type="submit"value="simpan">
<input type="reset"value="batal">
</td></tr>
</table>
</form>
</center>
=====Koneksi.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("sekolah");
?>
===List.php
<center>
<?php include"index.php";?>
<hr>
<table><tr bgcolor="#cccddd">
<td align="center"> No </td>
<td align="center"width="100">Nis</td>
<td align="center"width="400">Nama</td>
<td align="center"width="200">Telepon</td>
</tr>
<?php include"koneksi.php";
$sql="select*from siswa";
$hasil=mysql_query($sql);
while($row=mysql_fetch_array($hasil)){
$i=1;
echo"<tr><td>$i</td>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
</tr>";
$i++;
}
?>
</table>
</center>
===simpan.php
<?php
$a=$_POST['Nis'];
$b=$_POST['Nama'];
$c=$_POST['Telepon'];
include"koneksi.php";
$sql="insert into siswa values('$a','$b','$c')";
mysql_query($sql);
include"list.php";
?>
<?
include "koneksi.php";
$qry=mysql_query("select*from barang");
echo"<table border='1px' width='500px'>
<tr>
<th>No</th>
<th>kode_barang</th>
<th> barang </th>
<th> harga </th>
<th> spesifikasi </th>
<th>Aksi</th>
</tr>";
while($r=mysql_fetch_array($qry)){
echo"<tr>
<td>$No</td>
<td>$r[kode_barang] </td>
<td>$r[barang]</td>
<td>$r[harga] </td>
<td>$r[spesifikasi] </td>
<td><a href='formeditbarang.php?ID=$r[kodebrg]'>Edit</a></td>
</tr>";
}
echo"</table>";
?>
===form barang.php
<table border="1px" width="500px">
<tr>
<th colspan="2">:FORM BARANG:</th>
</tr>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="xkdbarang" size="30" maxlenght"10" value=""/></td>
</tr>
<tr>
<td>Barang</td>
<td><input type="text" name="xbarang" size="30" maxlenght"30" value=""/></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="xharga" size="30" maxlenght"30" value=""/></td>
</tr>
<tr>
<td>Spesifikasi</td>
<td><textarea name="xspesifikasi" rows="3" cols="10"></textarea></td>
</tr>
<tr>
<th><input type="submit" name="Simpan" value="Simpan"/></th>
<th><input type="reset" name="reset" value="Batal"/></th>
</tr>
</table>
</from>
===Form edit barang.php
<?
include"koneksi. . php";
$r=mysql_fetch_array(mysql_query)("select * from barang where kodebrg='$_REQUEST[ID]'"));
?>
<form action="simpaneditbarang.php"method="POST">
<table border="1px" width="500px">
<tr>
<th colspan="2">:FORM BARANG:</th>
</tr>
<tr>
<td>Kode Barang</td>
<td><input type="text" name="xkdbarang" size="30" maxlength="10" value="<? echo"$r[kodebrg]";?/>"/></td>
</tr>
<tr>
<td>Barang</td>
<td><input type="text" name="xbarang" size="30" maxlength="30" value="<? echo"$r[barang]";?/>"/></td>
</tr>
<tr>
<td>Harga</td>
<td><input type="text" name="xharga" size="30" maxlenght"30" value="<? echo"$r[harga]";?/>"/></td>
</tr>
<tr>
<td>Spesifikasi</td>
<td><textarea name="xspesifikasi" rows="3" cols="10">
<? echo"$r[Spesifikasi]";?/>
</textarea></td>
</tr>
<tr>
<td>Simpan</td>
<td><input type="submit/reset" name="Update" value="cancel"/></td>
</tr>
</table>
==index.php
<center>
<form action="simpan.php"method="post">
<table>
<tr><td>Nis</td>
<td>:</td>
<td><input type="text"name="Nis">
</td></tr>
<tr><td>Nama</td>
<td>:</td>
<td><input type="text"name="Nama">
</td></tr>
<tr><td>Telepon</td>
<td>:</td>
<td><input type="text"name="Telepon">
</td></tr>
<tr><td colspan="3"align="center">
<input type="submit"value="simpan">
<input type="reset"value="batal">
</td></tr>
</table>
</form>
</center>
=====Koneksi.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("sekolah");
?>
===List.php
<center>
<?php include"index.php";?>
<hr>
<table><tr bgcolor="#cccddd">
<td align="center"> No </td>
<td align="center"width="100">Nis</td>
<td align="center"width="400">Nama</td>
<td align="center"width="200">Telepon</td>
</tr>
<?php include"koneksi.php";
$sql="select*from siswa";
$hasil=mysql_query($sql);
while($row=mysql_fetch_array($hasil)){
$i=1;
echo"<tr><td>$i</td>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
</tr>";
$i++;
}
?>
</table>
</center>
===simpan.php
<?php
$a=$_POST['Nis'];
$b=$_POST['Nama'];
$c=$_POST['Telepon'];
include"koneksi.php";
$sql="insert into siswa values('$a','$b','$c')";
mysql_query($sql);
include"list.php";
?>