السلام عليكم و رحمة الله و بركاته
فيه عندي سكريبت اريد اضافة ميزة البحث في قسم معين فقط او في جميع الاقسام حسب الاختيار
فكيف لي عملها ؟
و هذا هو ملف البحث مع الفورم
1 - فورم البحث :
كود PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
include ("templates/header.htm");
?>
<head>
<meta http-equiv="Content-Language" content="en-us">
<htm>
<title> البحث </title>
</htm>
</head>
<div align="center">
<b><span lang="ar-sa"> <a href="index.php"><span style="text-decoration: none">الرئيسية</span></a></span></b><table border="0" cellpadding="0" style="border-collapse: collapse" width="40%" id="table3" height="23">
<tr>
<td width="25%" height="23" valign="top" align="center">
<table border="0" cellpadding="3" width="50%" id="table4" bordercolorlight="#663300" bordercolordark="#000000" bordercolor="#000000">
<tr>
<td bgcolor="#FFFFFF" style="border: 1px dashed #000080">
<body>
<form method="GET" action="search2.php">
<p align="center">
<font color="#C0C0C0">
<input type="text" name=Sender dir="rtl" size="20"></font> <b> <span lang="ar-sa"><br>
<input name="name" type="radio" value="1"><font color="#0000FF">اســم
الـعميــل</font>
<br><input name="name" type="radio" value="2" checked>
<font color="#008000">رقــم الـوصــل</font>
<br><input name="name" type="radio" value="3">
<font color="#FF0000">نـــوع الجهـاز</font>
<br><input name="name" type="radio" value="4">
تاريخ الإضافة</span></b> <br>
<input type="submit" value="أبحث"></p>
</form>
</body></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align="center">
<p><b><span lang="ar-sa"> </span></b></p>
</form>
</div>
<?php
include ("templates/footer.htm");
?>
و ملف البحث :
كود PHP:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-dz">
</head>
<?
include ("templates/header.htm");
include("admin/connect.php");
if (empty($Sender)) {
echo "<center> <b><u>íÑÌì ÇÏÎÇá ÇáÇÓã</u></b>";
echo "<meta http-equiv='refresh' content='2;url=search.php'>";
echo "<br>";
echo "<big>áÍÙÇÊ ÓæÝ íÊã ÊÍæíáß Çáì ÕÝÍÉ ÇáÈÍË ãÑå ÇÎÑì ÂáíÇð</big>"; include ("templates/footer.htm");
exit();
} include ("templates/footer.htm");
if($name==1)
{
$result = mysql_query("SELECT * FROM sms WHERE Sender RLIKE '$Sender' ");
}
if($name==2)
{
$result = mysql_query("SELECT * FROM sms WHERE sms RLIKE '$Sender' ");
}
if($name==3)
{
$result = mysql_query("SELECT * FROM sms WHERE rtv3 RLIKE '$Sender' ");
}
if($name==4)
{
$result = mysql_query("SELECT * FROM sms WHERE rtv6 RLIKE '$Sender' ");
} // äÍÏÏ ÇáÌÏæá Çæ ÇáÕÝ ÇáÐí Ýíå ÍÞá name íÓÇæí $name
if (mysql_num_rows($result) <1) { // ÇÐÇ áã íÌÏ ÔíÁ
echo "<center>ááÃÓÝ áÇ ÊæÌÏ äÊÇÆÌ<br><a href=search.php> ááÈÍË ãÑÉ ÇÎÑì ÇÖÚØ åäÇ</a>";
}
if (mysql_num_rows($result) > 0) { // ÇÐÇ æÌÏ ÔíÁ
echo "<center>äÊÇÆÌ ÇáÈÍË<table border=0 cellspacing=0 width=98% id='table1'>
</tr> </table><table border=1 cellspacing=0 width=98% bordercolor=#000000>
<tr bgcolor=#FAFFE8>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÊÚÏíá</td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> im</td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÇÓã ÇáÚãíá </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÑÞã ÇáæÕá </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> äæÚíÉ ÇáÌåÇÒ </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> Çááæä </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÇáÚØá </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÊÇÑíÎ ÇáÇÓÊáÇã </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÊÇÑíÎ ÇáÊÓáíã</td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> äÊíÌÉ ÇáÚãá </td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ãáÇÍÙÇÊ</td>
<td><font face='Tahoma' style='font-size: 11pt' color='#000080'><center> ÇáËãä</td>
</tr> <td>
";
while($dalil = mysql_fetch_array($result)) {
echo "
<tr>
<td><font face='Tahoma' style='font-size: 11pt' color='#008000'><center><a href=\"edit.php?id=$dalil[0]\">ÊÚÏíá</a><td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv]
<td><font face='Tahoma' style='font-size: 11pt' color='#008000'><a href=\"print.php?id=$dalil[0]\"><center>$dalil[Sender]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[sms]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv3]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv4]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv5]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv6]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv7]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv8]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv9]
<td><font face='Tahoma' style='font-size: 11pt' color='#FF0000'><center>$dalil[rtv2]
";
}
}
echo "<BR>";
$Sql = "select * from sms where Hidden!=1 order by SID DESC";
$Result = mysql_query($Sql);
while ($Row = mysql_fetch_array($Result))
{
extract($Row);
$SDate=Hijri($SDate);
$sms = str_replace(">", ">", $rtv2);
}
Echo " </table>";
Echo "</html>";
include ("templates/footer.htm");
?>
و طريقة استدعاء الاقسام هي :
كود PHP:
$Sql = "select * from cat Where CatID='0' order by id";
فكيف يمكنني فعل ذالك اي البحث المتقدم ؟؟؟