You are on page 1of 1

<html>

<head>
<title>Bidang Study</title>
</head>
<body>
<?php
$konek=mysql_connect("localhost", "root", "") or die ("Gagal konek ke server.");
mysql_select_db("sia_smkn4batam") or die ("Gagal membuka database.");
?>

<h3><p align="left">Tambah Bidang Study</p></h3>


<form name="form1" method="post" action="insert_bidang_studi.php">
<table>
<tr>
<td width="100">Kode Bidang </td>
<td width="10"> </td>
<td width="138"><input name="kd_bidang" type="text" id="kd_bidang"
size="10" maxlength="10" required="required" /></td>
</tr>
<tr>
<td>Nama Bidang </td>
<td> </td>
<td><input name="nm_bidang" type="text" id="nm_bidang" size="20"
maxlength="30" required="required" /></td>
</tr>

<tr><td><input value="Simpan" name="submit" type="submit" /></td></tr>


<tr><td><input value="Kembali" type="button"
onClick="self.history.back()"></td></tr>
</table>
</form>

<table border="5">
<tr>
<th>Kode Bidang</th>
<th>Nama Bidang</th>
<th colspan="3">Aksi</th>
</tr>
<?php
$query = "select * from bidang_studi";
$result = mysql_query($query, $konek);
while ($buff = mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $buff['kd_bidang']; ?></td>
<td><?php echo $buff['nm_bidang']; ?></td>

<td><a href="edit_bidang_studi.php?kd_bidang=<?php echo $buff['kd_bidang']; ?


>">Edit</a> |
<td><a href="delete_bidang_studi.php?kd_bidang=<?php echo $buff['kd_bidang']; ?
>">Hapus</a>
</tr>
<?php
};
mysql_close($konek);
?>
</table>
</body>
</html>

You might also like