Koneksi.php
<?php$server="localhost";$username ="root";$password ="";$database ="abc";mysql_connect($server,$username,$password) or die("gagal");mysql_select_db($database) or die("Database tidak ditemukan");?>
Input.php
<html>PENDAFTARAN SISWA BARU<table><form method=post action = prosesinput.php><tr><td>Nomor</td><td>: <input type = text name=no size=3><br></td></tr><tr><td>Nama</td><td>: <input type = text name=nama size=20><br></td></tr><tr><td>Asal</td><td>: <input type = text name=asal size=20> </td></tr><tr><td><input type=submit name=submit value=Daftar></td><td><input type=reset name=reset value=Batal></td></tr></form></table></html>
Prosesinput.php
<?phpinclude("koneksi.php");mysql_query ("INSERT INTO daftar(no, nama, asal) VALUES('$_POST[no]','$_POST[nama]','$_POST[asal]')");echo("Selamat! Anda sudah terdaftar, data anda:<br><br>");echo("<table>");echo("<tr><td>Nomor</td> <td>: <b>$_POST[no]</b></td></tr>");echo("<tr><td>Nama Siswa</td> <td>: <b>$_POST[nama]</b></td></tr>");echo("<tr><td>Asal Sekolah</td> <td>: <b>$_POST[asal]</b></td></tr>");echo("<tr><td><form method=post action=tampil.php>");echo("<input type=submit name=submit value='Lihat Data'></form></td>");echo("<td><form method=post action=input.php>");echo("<input type=submit name=submit value='Daftar lagi'></form></td></tr></table>");?>
Tampil.php
<?phpecho("Daftar Pengiriman Barang \"SEKOLAH IMBA\"<br><hr><br>");echo("<table border=1>");echo("<tr><td>Nomor</td><td>Nama Siswa</td><td>Asal Sekolah</td></tr>");include("koneksi.php");$perintah="select * from daftar order by no";$tampil_data=mysql_query($perintah);while($data=mysql_fetch_row($tampil_data)){echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td><a href=edit.php?id=$data[0]>Edit</a></td><td><a href=hapus.php?id=$data[0]>Hapus</a></td></tr>");}echo("</table>");echo("<form method=post action=input.php>");echo("<input type=submit name=submit value='Daftar Lagi'></form>");?>
Edit.php
include("koneksi.php");$edit=mysql_query("select * from daftar where no='$_GET[id]'");$data=mysql_fetch_array($edit);
echo"<h2>Edit Data</h2><form method=POST action=update.php><table><tr><td>Nomor Induk</td><td>: <input type=text name=no value='$data[no]'></td></tr><tr><td>Nama Siswa</td><td>: <input type=text name=nama value='$data[nama]'></td></tr><tr><td>Asal Sekolah</td><td>: <input type=text name=asal value='$data[asal]'></td></tr>
Add a Comment
This document has made it onto the Rising list!