Postingan lainnya
data update tidak bisa tersipan di dalam database
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
-->
<script type="text/javascript" src="dropdowntabs.js">
/***********************************************
* Drop Down Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Perancangan Aplikasi Perpustakaan</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="topmenu">
<ul>
<li><a href="#" id="topmenu1" accesskey="1" title="">Home</a></li>
<li><a href="#" id="topmenu2" accesskey="2" title="">Contact</a></li>
<li><a href="#" id="topmenu3" accesskey="3" title="">Sitemap</a></li>
</ul>
</div>
<div id="logo">
<h1><a>Perpustakaan Sekolah</a></h1>
<h2><a>Project</a></h2>
</div>
</div>
<!--Tempat Menambahkan Menu -->
<div id="glowmenu" class="glowingtabs">
<ul>
<li><a href="perpussekolah.php" title="Home"><span>Home</span></a></li>
<br>
<br>
<?php
//load koneksi
include 'koneksi.php';
$id=$_GET['id'];
//load data
$load_anggota="SELECT * FROM anggota where kode_anggota='$id'";
$data=mysql_query ($load_anggota,$connect) or die (mysql_error());
?>
<head>
</head>
<body>
<table width="1300" border="4">
<tr>
<td colspan="4" align="center"><h1>EDIT DATA</h1></td>
</tr>
<form name="edit" action="proses.php" method="post">
<table>
<?php
$id = mysql_fetch_assoc($data) ;
?>
<tr>
</table>
<br>
<table border="0" cellpadding="10" style="border-collapse:collapse">
<tr>
<td>Kode Anggota</td>
<td>:</td>
<td><input type="text" name="kode_anggota" size="20" value="<?php echo $id['kode_anggota'];?> "></td>
</tr>
<tr>
<td>Nim</td>
<td>:</td>
<td><input type="text" name="nim" size="20" value="<?php echo $id['nim'];?> "></td>
</tr>
<tr>
<td>Nama</td>
<td>:</td>
<td><input type="text" name="nama" size="50" value="<?php echo $id['nama'];?> "></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><textarea name="alamat" rows="5" cols="50" ><?php echo $id['alamat'];?></textarea></td>
</tr>
<tr>
<td>Prodi</td>
<td>:</td>
<td>
<select name="prodi">
<?php
//load prodi
$load_prodi="select * from prodi";
$view_prodi=mysql_query ($load_prodi,$connect) or die (mysql_error());
while ($prodi = mysql_fetch_assoc($view_prodi, MYSQL_ASSOC))
{
?>
<option value="<?php echo $prodi['kode_prodi'];?>" <?php if ($prodi['kode_prodi']==$id['prodi'])
{ echo "selected";}?>><?php echo $prodi['nama_prodi']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Jenis Anggota</td>
<td>:</td>
<td><input type="radio" name="jenis_anggota" value="1" <?php if ($id['jenis_anggota']==1) { echo "checked";}?>> Biasa
<input type="radio" name="jenis_anggota" value="2" <?php if ($id['jenis_anggota']==2) { echo "checked";}?>>Luar Biasa
</td>
</td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td><input type="radio" name="jenis_kelamin" value="1" <?php if ($id['jenis_kelamin']==1) { echo "checked";}?>>Laki
<input type="radio" name="jenis_kelamin" value="0" <?php if ($id['jenis_kelamin']==0) { echo "checked";}?>>Perempuan
</td>
</td>
</tr>
</table>
<br>
<td>
<input type="hidden" name="id" value="<?php echo $id['kode_anggota'];?>">
<input type ="submit" value ="Simpan">
</form>
<?php
include("koneksi.php");
$kode_anggota=$_POST['kode_anggota'];
$nim=$_POST['nim'];
$nama=$_POST['nama'];
$alamat=$_POST['alamat'];
$prodi=$_POST['prodi'];
$jenis_anggota=$_POST['jenis_anggota'];
$jenis_kelamin=$_POST['jenis_kelamin'];
//query for update data in database
$update_anggota="UPDATE anggota set nim='$nim',nama='$nama',alamat='$alamat',
prodi='$prodi',jenis_kelamin=$jenis_kelamin,jenis_anggota=$jenis_anggota
where kode_anggota=$kode_anggota";
$update=mysql_query($update_anggota,$connect) ;
if ($update) {
header('location:anggota.php');
} else {
// jika tidak, tampilkan pesan gagal menyimpan
echo "Ouppsss..., maap proses menyimpan data tidak berhasil";
}
?>
0
Tanggapan
Errornya sebelah mana? line berapa? Bisa diperjelas atau kasih screenshoot errornya?
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban