Form_edit_air_tanah.php
<html>
<head>insert air tanah</head>
<style>
body{
background:#000033; font:12px Arial; }
h1{
color:#0066FF }
form{
border:1px solid; width:80%; margin:10px; padding:15px 10px;
-moz-border-radius:
10px; -webkit-border-radius: 10px; border-radius: 10px; }
#rst{
color:white; font-size:16px; }
</style>
<body bgcolor="#000033">
<table border="0"
color="red" width="900" height=""
BGCOLOR="#FFFFFF" align="center">
<tr>
<td >
<?php
include "headadmin.php";
?>
</td>
</tr>
<td valign="top">
<center>
<h1>Ubah Data Potensi Air
Tanah</h1>
<?php
include "koneksi.php";
$query = "select * from airtanah where
id_bws='".mysql_real_escape_string($_GET['id'])."'";
$result = mysql_query($query);
$airtanah = mysql_fetch_array($result);
?>
<form name="airtanah"
id="airtanah" action="edit_airtanah.php"
method="post">
<table>
</td></tr>
<tr><td>id
CAT</td><td>:</td>
<td>
<input type="text"
name="id_cat" size="20" maxlength="8"
disabled="disable" required="required" value="<?php
echo"$airtanah[id_cat]";?>">
</td></tr>
<tr><td>BWS &
BBWS</td><td>:</td>
<td> <select
name="id_bws" id="id_bws"
onChange="pilih(this.value)">
<option value="<?php
echo"$airtanah[id_bws]"; ?>"
selected="selected"><?php echo"$airtanah[id_bws]";
?></option>
<?php
include "koneksi.php";
$query_limit=mysql_query("select * from wilayahbws");
while($row=mysql_fetch_array($query_limit))
{
?><option
value="<?php echo
$row['id_bws']; ?>"><?php
echo $row['nm_bws']; ?></option><?php
}
?>
</select>
</td>
<td>Nama
CAT</td><td>:</td>
<td>
<input type="text"
name="nama_cat" cols="30" rows="5"
maxlength="50"
size="36" required="required" value="<?php
echo"$airtanah[nama_cat]";?>">
</td></tr>
<tr>
<td>Debit
Optimum</td><td>:</td>
<td>
<input type="text"
name="debit_optimum" cols="30" rows="5"
maxlength="9"
size="20" value="<?php echo"$airtanah[debit_optimum]";?>">
_Liter/Det</td></tr>
<tr>
<td>Potensi</td><td>:</td>
<td>
<select name="potensi"
value="<?php echo"$airtanah[potensi]"; ?>>
<option value="Baik"
selected="selected">Baik</option>
<option value="Cukup
Baik">Cukup Baik</option>
<option
value="Kurang">Kurang</option>
</select>
</td></tr>
<tr>
<td>Lokasi</td><td>:</td>
<td>
<input type="text"
name="lokasi" cols="30" rows="5"
maxlength="50"
size="36" value="<?php
echo"$airtanah[lokasi]";?>">
</td></tr>
<tr>
<td>Keterangan</td><td>:</td>
<td>
<textarea
name="keterangan" cols="30" rows="5"
maxlength="500"
size="20" ><?php
echo"$airtanah[keterangan]";?></textarea>
</td></tr>
<tr><td colspan="3"
align="center"> <br>
<input type="hidden"
name="id_cat" value="<?php echo
"$airtanah[id_cat]"; ?>">
<input type="submit"
name="save" value="Update"/></td></tr>
</form>
</td>
</tr> </table>
<tr>
<td >
<?php
include "footeradmin.php";
?>
</td>
</tr>
</table>
</body>
</html>
Keterangan
: <input
type="text" name="id_cat" size="20"
maxlength="8" disabled="disable"
required="required" value="<?php
echo"$airtanah[id_cat]";?>">
</td></tr>
<tr><td>BWS &
BBWS</td><td>:</td>
<td> <select
name="id_bws" id="id_bws"
onChange="pilih(this.value)">
<option value="<?php
echo"$airtanah[id_bws]"; ?>"
selected="selected"><?php echo"$airtanah[id_bws]";
?></option>
<?php
include "koneksi.php";
$query_limit=mysql_query("select * from wilayahbws");
while($row=mysql_fetch_array($query_limit))
{
?><option
value="<?php echo
$row['id_bws']; ?>"><?php
echo $row['nm_bws']; ?></option><?php
}
?>
</select>
Merupakan script untuk koneksi ke tabel yang lain
(tabel wilayah BWS) yang akan di bahas di postingan berikutnya. Untuk lebih
memudahkan bisa di ganti tex seperti yang di atasnya.
Kemudian buat notepad form_edit_air_tanah.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Save Ubah Data
Danau</title>
</head>
<style>
body{ background:#000033; font:12px
Arial; }
h1{ color:#0066FF }
form{ border:1px solid; width:60%;
margin:10px; padding:15px 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px; border-radius: 10px; }
#rst{ color:white; font-size:16px; }
</style>
<body
bgcolor="#000033">
<table border="0" color="red"
width="900" height="" BGCOLOR="#FFFFFF"
align="center">
<tr>
<td >
<?php
include "headadmin.php";
?>
</td>
</tr>
<tr>
<td width="30">
<?php
include "headadmin.php";
?>
</td>
<td valign="top">
<center>
<?php
$id_bws = $_POST['id_bws'];
$id_cat = $_POST['id_cat'];
$nama_cat = $_POST['nama_cat'];
$debit_optimum = $_POST['debit_optimum'];
$potensi = $_POST['potensi'];
$lokasi = $_POST['lokasi'];
$keterangan =
$_POST['keterangan'];
//koneksi database
include "koneksi.php";
$query = "update airtanah set id_bws='$id_bws', nama_cat='$nama_cat',
debit_optimum='$debit_optimum',
potensi='$potensi', lokasi='$lokasi', keterangan='$keterangan' where
id_cat='$id_cat'";
$hasil = mysql_query($query);
if($hasil){
echo "Data Air Tanah telah diupdate";
}else{
echo "Error! gagal menyimpan data Air Tanah:".mysql_error();
}
echo"<li><font color=RED><a href=airtanah.php>Lihat
data </a></font></li>";
?>
</td>
</tr>
<tr>
<td>
<?php
include "footeradmin.php";
?>
</td>
</tr>
</table>
</body>
</html>
hasil :
0 comments:
Post a Comment