linkedin facebook linkedin facebook nod32

Yuqori menyuni tahrirlash bo`limini admin panelini yaratish usuli

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2016-02-09

Yuqori menyuni tahrirlash bo`limini admin panelini yaratish usuli

Video darslik 

Yuqoridagi menyu malumotlari o`zgarmaydigan ma`lumot sohasi bo`lishi kerak. Bizda Boshsahifa, video kurs, muallif va bog`lanish menyu mavjud bundagi ma`lumotni admin paneli orqali tahrirlashni ko`rib chiqamiz.
Biz quyidagi faylni hosil qilib olishimiz kerak.

boshmenyu_yangilash.php

<?php
include ("lock.php");
include ("baza.php");
if (isset($_GET['id'])) {$id = $_GET['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>Boshmenyu matnni o'zgartirish saxifasi</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="ckeditor/ckeditor.js"></script>
</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="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--chapmenyuni include yo`rdamida chaqirib olish -->
<? include ("chapmenyu.php");  ?>      
<td valign="top">
<p><strong>Berilgan yuqoridagi tugmalarni ma'lumotlarni taxrirlash </strong></p>     
<?
if (!isset($id))
{
$result = mysql_query("SELECT title,id FROM boshmenyu");     
$myrow = mysql_fetch_array($result);
do
{
printf ("<p><a href='boshmenyu_yangilash.php?id=%s'>%s</a></p>",$myrow["id"],$myrow["title"]);
}
while ($myrow = mysql_fetch_array($result));
}
else
{
$result = mysql_query("SELECT * FROM boshmenyu WHERE id=$id");     
$myrow = mysql_fetch_array($result);
print <<<HERE
<form name="form1" method="post" action="boshmenyu_kiritish.php">
<p>
<label>Mavzuning sahifa nomini kiriting <br>
<input name="title" type="text" id="title" value="$myrow[title]" size="75">
</label>
</p>
<p>
<label>Qisqa nom kiriting<br>
<input name="meta_d" type="text" id="meta_d" value="$myrow[meta_d]" size="75">
</label>
</p>
<p>
<label>Kalit so`z kiriting<br>
<input name="meta_k" type="text" id="meta_k" value="$myrow[meta_k]" size="75">
</label>
</p>
<p>
<label>To`liq matnni kiritish bo`limi
<textarea name="text" id="text" cols="740" rows="200">$myrow[text]</textarea>
</label>
<script>CKEDITOR.replace( 'text' );</script>
</p>
<input name="id" type="hidden" value="$myrow[id]">
<p>
<label>
<input type="submit" name="submit" id="submit" value="O'zgartirishni saqlash">
</label>
</p>
</form>
HERE;
}
?>
</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>

boshmenyu_kiritish.php ma’lumotni bazaga boshmenyu jadvalga yuboradi quyida php kodi keltirilgan.

<?php
include ("lock.php");
include ("baza.php");
if (isset($_POST['title']))      
{
$title = $_POST['title'];

if ($title == '')
{
unset($title);

}

if (isset($_POST['meta_d']))      {$meta_d = $_POST['meta_d']; if ($meta_d == '') {unset($meta_d);}}
if (isset($_POST['meta_k']))      {$meta_k = $_POST['meta_k']; if ($meta_k == '') {unset($meta_k);}}
if (isset($_POST['text']))        {$text = $_POST['text']; if ($text == '') {unset($text);}}
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>Tayyorlash</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($title) && isset($meta_d) && isset($meta_k) && isset($text))
{

$result = mysql_query ("UPDATE boshmenyu SET title='$title', meta_d='$meta_d', meta_k='$meta_k', text='$text' WHERE id='$id'");

if ($result == 'true') {echo "<p>Malumotingiz yangilandi!</p>";}
else {echo "<p>Malumotingiz yangilanmadi!</p>";}

 

}                
else

{
echo "<p>Axborot so'rovi bazaga saqlanmadi bazada jadval yo'q.</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>

303 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений