Ma`lumotlar : 1092
Xabarlar soni: 314
Bugun: 19.3.2024
Soat: 6:7
Chap menyuni ma’lumotni o`chirish bo`limini admin panelini yaratish usuli
Muallif: Mengliyev Sh.
Qo`shilgan sana: 2016-02-09
Chap menyuni ma’lumotni o`chirish bo`limini admin panelini yaratish usuli
Biz quyidagi chap_uchirish.php faylini yaratib olamiz buning uchun quyidagi kodni ko`chrib olamiz.
chap_uchirish.php
<?php
include ("lock.php");
include ("baza.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Guruh betini o'chirish</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="690" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="main_border">
<tr>
<td class="left"> <p align=center> <b><i>Saytga ma'lumot kiritish administrator bo`limi</i><b> </p></td>
</tr>
<tr>
<td><table width="690" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--chapmenyuni include yo`rdamida chaqirib olish -->
<? include ("chapmenyu.php"); ?>
<td valign="top">
<p><strong>O'chiriladigan toifani belgilang </strong></p>
<form action="chap_baza_uchirish.php" method="post">
<?
$result = mysql_query("SELECT title,id FROM chap");
$myrow = mysql_fetch_array($result);
do
{
printf ("<p><input name='id' type='radio' value='%s'><label> %s</label></p>",$myrow["id"],$myrow["title"]);
}
while ($myrow = mysql_fetch_array($result));
?>
<p> <input name="submit" type="submit" value="Menyuni o`chirish!"></p>
</form>
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="left"><p align=center>Saytga ma'lumot kiritish administrator quyi bo`limi</p></td>
</tr>
</table>
</body>
</html>
Chapmenyudagi ma’lumotni o`chirish bo`limi chap_baza_uchirish.php quyida php kodi keltirilgan.
chap_baza_uchirish.php
<?php
include ("lock.php");
include ("baza.php");
if (isset($_POST['id'])) {$id = $_POST['id'];}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Qayta ishlash</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="690" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="main_border">
<tr>
<td class="left"> <p align=center> <b><i>Saytga ma'lumot kiritish administrator bo`limi</i><b> </p></td>
</tr>
<tr>
<td><table width="690" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--chapmenyuni include yo`rdamida chaqirib olish -->
<? include ("chapmenyu.php"); ?>
<td valign="top">
<?php
if (isset($id))
{
$result0 = mysql_query ("SELECT id FROM data WHERE cat='$id'",$db);
if (mysql_num_rows($result0) > 0) {
echo "<p>Axborot so'rovi bazaga saqlanmadi bazada jadval yo'q.</p>";
}
else
{
$result = mysql_query ("DELETE FROM chap WHERE id='$id'");
if ($result == 'true') {echo "<p>Siz ma`lumotni o`chirishga ulgurdingiz!</p>";}
else {echo "<p>SSiz ma`lumotni ulgurmadingiz!</p>";}
}
}
else
{
echo "<p>Tanlangan so'rov bazaga yuborilmadi. Adminstratorga xat yozing admin@tami.uz. <br> <strong>id xato:</strong></p>";
}
?>
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="left"><p align=center>Saytga ma'lumot kiritish administrator quyi bo`limi</p></td>
</tr>
</table>
</body>
</html>
1874 marta o`qildi.