0% found this document useful (0 votes)
4K views

Source Code Sistem Informasi Sederhana Dengan PHP Dan MySQL

Source code buat ujian praktek nanti. Tolong dipelajari dan kode dijamin berhasil. Tested by XAMPP Lite and Apple Safari

Uploaded by

Albert Hutama
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4K views

Source Code Sistem Informasi Sederhana Dengan PHP Dan MySQL

Source code buat ujian praktek nanti. Tolong dipelajari dan kode dijamin berhasil. Tested by XAMPP Lite and Apple Safari

Uploaded by

Albert Hutama
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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
<?php
include("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
<?php
echo("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>
<tr><td colspan=2><input type=submit value=update>
<input type=button value=Batal onclick=self.history.back()></td></tr>
</table></form>";
?>

Update.php
<?php
include ("koneksi.php");
mysql_query("UPDATE pesan SET no='$_POST[no]', nama='$_POST[nama]', asal='$_POST[asal]' where
no='$_POST[no]' ");
?>

Hapus.php
<?php
include("koneksi.php");
mysql_query("DELETE FROM pesan where no='$_GET[id]'");
?>

You might also like