EDIT / UPDATE DATA
1. Coding
edit_siswa.php
<form name="form1" method="post" action="update_siswa.php">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1"
bordercolor="#FFFF99" bgcolor="#FF0000">
<tr bgcolor="#FFFFCC">
<td height="50" colspan="2"><div align="center">EDIT DATA</div></td>
</tr>
<?php
include ("koneksi.php");
$sqlTampil="select * from siswa Where nis='$_GET[nis]'";
$qryTampil=mysql_query($sqlTampil);
$dataTampil=mysql_fetch_array($qryTampil);
?>
<tr bgcolor="#FFFFFF">
<td height="40">Nis </td>
<td>:
<input name="nis" type="text" id="nis" readonly value="<?php
echo $dataTampil['nis']; ?>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="40">Nama </td>
<td>:
<input name="nama_siswa" type="text" id="nama_siswa" value="<?php
echo $dataTampil['nama']; ?>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td height="50"><input type="submit" name="Submit" value="Simpan"></td>
</tr>
</table>
</form>
update_siswa.php
<?php
include ("koneksi.php");
$update="UPDATE siswa SET
nama='$_POST[nama_siswa]' WHERE nis='$_POST[nis]'";
mysql_query($update);
echo "<center>Data Berhasil Di Update<center>";
echo "<center><h3><a href='tampil_siswa.php'>Back</a></h3></center>";
?>
hapus_siswa.php
<?php
include ("koneksi.php");
$delete="Delete from siswa WHERE nis='$_GET[nis]'";
mysql_query($delete) or die ("Error bos");
echo "<center><h3>Data berhasil di hapus</h3></center>";
echo "<center><h3><a href=tampil_siswa.php>Back</a></h3></center>";
?>
Komentar
Posting Komentar