linkedin facebook linkedin facebook nod32

Data jadvalga ma’lumotni tahrirlash bo`limini admin panelini yaratish usuli

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2016-02-10

Data jadvalga ma’lumotni tahrirlash bo`limini admin panelini yaratish usuli

Video darslik 

Biz biror bir ma’lumotni qayta ishlab uni axborot sifatida internetga joylashtiramiz buni quyidagi Biz quyidagi malumot_tahrirlash.php faylini yaratib olamiz buning uchun quyidagi kodni ko`chrib olamiz.

malumot_tahrirlash.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>Ma`lumotni tahrirlash paneli</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="690" border="0" cellspacing="0" cellpadding="0">
<tr>
<!--chapmenyuni include yo`rdamida chaqirib olish -->
<? include ("chapmenyu.php");  ?>     
<td valign="top">
<?
if (!isset($id))
{
$result = mysql_query("SELECT title,id FROM data");     
$myrow = mysql_fetch_array($result);
do
{
printf ("<p><a href='malumot_tahrirlash.php?id=%s'>%s</a></p>",$myrow["id"],$myrow["title"]);
}
while ($myrow = mysql_fetch_array($result));
}
else
{
$result = mysql_query("SELECT * FROM data WHERE id=$id");     
$myrow = mysql_fetch_array($result);
$result2 = mysql_query("SELECT id,title FROM cat");     
$myrow2 = mysql_fetch_array($result2);
$count = mysql_num_rows($result2);

echo "<h3 align='center'>Tahrirlash bo`limi</h3>";
echo "<form name='form1' method='post' action='tahrirlash.php'>
<p>Cat mavzu nomi yuborish<br><select name='cat' size='$count'>";
do
{
if ($myrow['cat'] == $myrow2['id'])
{
printf ("<option value='%s' selected>%s</option>",$myrow2["id"],$myrow2["title"]);
}
else
{
printf ("<option value='%s'>%s</option>",$myrow2["id"],$myrow2["title"]);
}
}
while ($myrow2 = mysql_fetch_array($result2));
echo "</select></p>";
print <<<HERE
<p>
<label>Darsning nomini kiriting<br>
<input value="$myrow[title]" type="text" name="title" id="title" size="75">
</label>
</p>
<p>
<label>Darsning qisqa nomini kiriting<br>
<input value="$myrow[meta_d]" type="text" name="meta_d" id="meta_d" size="75">
</label>
</p>
<p>
<label>Darsning kalit so`zini kiriting<br>
<input value="$myrow[meta_k]" type="text" name="meta_k" id="meta_k" size="75">
</label>
</p>
<p>
<label>Dars qo`shilganligini sanasini kiriting<br>
<input value="$myrow[date]" name="date" type="text" id="date" value="2013-10-27">
</label>
</p>
<p>
<label>Teg yordamida barcha darsning bayonini kiriting
<textarea name="text" id="text" cols="40" rows="20">$myrow[text]</textarea>
<script>CKEDITOR.replace( 'text' );</script>
</label>
</p>
<p>
<label>Dars muallifini kiriting<br>
<input value="$myrow[author]" type="text" name="author" id="author">
</label>
</p>
<p>
<label>Kichik rasmning manzilini kiriting<br>
<input value="$myrow[mini_img]" type="text" name="img" id="img">
</label>
</p>
<input name="id" type="hidden" value="$myrow[id]">
<p>
<label>
<input type="submit" name="submit" id="submit" value="O`zgartirishlarni 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>

data jadvaldagi ma’lumotni tahrirlash bo`limi tahrirlash.php quyida php kodi keltirilgan.

tahrirlash.php

<?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['date']))        {$date = $_POST['date']; if ($date == '') {unset($date);}}
if (isset($_POST['text']))        {$text = $_POST['text']; if ($text == '') {unset($text);}}
if (isset($_POST['author']))      {$author = $_POST['author']; if ($author == '') {unset($author);}}
if (isset($_POST['id']))      {$id = $_POST['id'];}
if (isset($_POST['cat']))      {$cat = $_POST['cat']; if ($cat == '') {unset($cat);}}
if (isset($_POST['img']))      {$img = $_POST['img']; if ($img == '') {unset($img);}}
?>
<!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>Ma`lumotni tahrirlash bo`limi</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($date)  && isset($text) && isset($author) && isset($cat) && isset($img))
{
$result = mysql_query ("UPDATE data SET title='$title', meta_d='$meta_d', meta_k='$meta_k', date='$date',  text='$text', author='$author', cat='$cat', mini_img='$img' WHERE id='$id'");
if ($result == 'true') {echo "<p>Ma`lumot yangilandi!</p>";}
else {echo "<p>Ma`lumot 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>

522 marta o`qildi.

Foydalanuvchi ismi: admin
Qo`shilgan sana: 2016-03-04

ishladi rahmat

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
счетчик посещений