File: /home/sinanpasha/public_html/risale/yeni/bilpanel/kategori-guncelle.php
<?php
// Yönetici Kontrol dosyasını çağır
include ("include-panel/yonetici-kontrol.php");
// Link ile gönderilen guncelle_id değişkenini $_GET ile çek.
$guncelle_id = $_GET ["guncelle_id"];
$bilgiler = mysql_query(" select * from kategoriler where kategori_id='$guncelle_id' ");
$dizi = mysql_fetch_array($bilgiler);
$kategori_adi = $dizi ["kategori_adi"];
$description = $dizi ["description"];
$durum = $dizi ["durum"];
if ( $_POST ["button"] ) {
//Butona basınca Formdan bilgileri $_POST ile tekrar çek.
$kategori_adi = $_POST ["kategori_adi"];
$description = $_POST ["description"];
$durum = $_POST ["durum"];
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Bil Soft Eticaret - Yönetim Paneli - Kategori Güncelle</title>
<link rel="stylesheet" type="text/css" href="css-panel/stiller.css">
<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<SCRIPT language=javascript>
function textareaLimiter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
else countfield.value = maxlimit - field.value.length;
}
</SCRIPT>
</head>
<body>
<!-- ==================== Header Top ==================== -->
<?php
include("include-panel/header-top.php");
?>
<!-- ==================== Wrapper Top ==================== -->
<div id="wrapper" class="sablon_width">
<?php
include ("include-panel/header.php");
?>
<div id="page_title">
<h1>KATEGORİ GÜNCELLE</h1>
</div>
<div id="page_content">
<form name="form1" method="post" action="">
<table width="450" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td width="110" scope="col">Kategori Adı</td>
<td width="10" scope="col">:</td>
<td width="172" scope="col"><input name="kategori_adi" type="text" id="kategori_adi" value="<?php echo $kategori_adi;?>" size="25" maxlength="50"></td>
<td width="93" scope="col"> </td>
</tr>
<tr>
<td>Description</td>
<td>:</td>
<td><textarea name="description" cols="25" rows="4" id="description" onkeyup="textareaLimiter(this.form.description,this.form.descLen,160);" onkeydown="textareaLimiter(this.form.description,this.form.descLen,160);"><?php echo $description;?></textarea></td>
<td><input name="descLen" value="160" size="4" maxlength="3" readonly ></td>
</tr>
<tr>
<td>Durum</td>
<td>:</td>
<td><input name="durum" type="checkbox" id="durum" value="1" <?php if ( $durum==1 ) { echo ' checked="CHECKED" '; } ?> ></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="button" id="button" value="Kategori Güncelle"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>
<?php
if ( $_POST ["button"] ) {
// Butona basılmış ise kontrolleri yap
if (!$kategori_adi) {
echo "Kategori adı giriniz";
} elseif (!$description) {
echo "Description giriniz";
} else {
// Kategori güncelle başladı
$guncelle = mysql_query("update kategoriler set kategori_adi='$kategori_adi', description='$description', durum='$durum' where kategori_id='$guncelle_id' ");
if ($guncelle) {
echo "Kategori güncellendi";
header("refresh:3;url=kategoriler.php");
} else {
echo "HATA : Kategori güncellenemedi";
}
//--------------------------
}
//--------------------------------------
}
?>
</td>
<td> </td>
</tr>
</table>
</form>
</div>
</div>
<!-- ==================== Footer Bottom ==================== -->
<?php
include("include-panel/footer.php");
?>
</body>
</html>