|
|
|
ใครพอจะมีโค๊ดการค้นหาในลักษณะนี้ไหมค่ะ หรือว่ามี เครื่องมือช่วยพวก .js พวกนี้้ ช่วยหน่อยค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<? include ("../connection/connect.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"><!-- InstanceBegin template="/Templates/template_client.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Storage and retrieval</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../Templates/styleclient.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function clearText(field) {
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}
</script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
.style1 {font-size: small}
.style3 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
a:hover {
color:#006;
}
-->
</style></head>
<body>
<div></div>
<div id="header_wrapper">
<div id="header">
<p><img src="../images/headdf.jpg" width="1000" height="182" /></p>
<div id="site_title"><!-- end of menu -->
<div id="menu">
<ul>
<li><a href="show_npro.php" class="current">หน้าแรก</a></li>
<li><a href="advance_search.php">ค้นหางานปริญญานิพนธ์</a></li>
<li><a href="advance_search">แบบฟอร์มการทำปริญญานิพนธ์</a></li>
<li><a href="#">รูปแบบการใช้งาน </a></li>
<li></li>
<li></li>
<li><a href="../register/loginadmin.php">ผูู้ดูแลระบบ </a></li>
</ul>
</div>
</div>
<div class="cleaner"></div>
</div>
<!-- end of header -->
</div>
<!-- end of header_wrapper -->
<div id="content_wrapper">
<div id="sidebar">
<div class="sidebar_section">
<h2>LINK</h2>
<div class="sidebar_section_content">
<ul class="categories_list">
<li><a href="http://is.bakkw.rmutr.ac.th/">สาขาเทคโนโลยีสารสนเทศทางธุรกิจ</a></li>
<li><a href="aj.php">ข้อแนะนำในการจัดทำ(Project)</a></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
<div class="cleaner_h30"></div>
</div>
<div id="content">
<div class="content_section">
<h2><!-- InstanceBeginEditable name="หัวข้อ" --><!-- InstanceEndEditable --></h2>
<!-- InstanceBeginEditable name="EditRegion3" -->
<? if (isset ($_GET['keyword'])) {
}
else{
$kw =$_GET['keyword'];
$match=$_GET['match'];
$projecttype_id=$_GET['projecttype_id'];
$year_id1=$_GET['year_id1'];
$year_id2=$_GET['year_id2'];
if($match =="start"){
$kw="$kw%";
}
else if($match=="someone"){
$kw="%$kw%";
}
else if($match =="end"){
$kw="%kw";
}
}
?>
<script language="javascript">
function Listprojecttype(SelectValue)
{
if(SelectValue != "")
window.location.href="advance_search.php?a="+SelectValue;
}
</script>
<form id="search_pro" name="search_pro" method="post" action="../client/show_thesis.php?id_thesis" target="iframe_target">
<iframe id="iframe_target" name="iframe_target" src="#" style="width:0;height:0;border:0px solid #FFFFFF;"></iframe>
<div id="divResult"></div>
<div id="newspaper-b">
<p>
<?
$id=$projecttype_id;
$projecttype_name=$projecttype_name;
//echo "id : " . " " . $id . "<br>";
?>
</p>
<table border="0" cellspacing="3" cellpadding="0" width="664" align="center" style="border:thin dashed">
<tbody>
<tr>
<th colspan="2"><p>ท่านสามารถเลือกสืบค้นข้อมูลได้จากทางเลือกต่อไปนี้</p></th>
</tr>
<tr>
<td width="182"><div align="right">
<select name="ddldeveloper2" id="ddldeveloper2">
<option value="developer">ชื่อผู้แต่ง</option>
<option value="project_name">ชื่อเรื่อง</option>
<option value="keyword">คำสำคัญ</option>
</select>
</div></td>
<td width="447"><input name="keyword" id="keyword" size="60" maxlength="100" /></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><input value="start" checked="checked" type="radio" name="match" />
ขึ้นต้นด้วย
<input value="someone" type="radio" name="match" />
ส่วนใดส่วนหนึ่ง
<input value="whole" type="radio" name="match" />
ตรงกันทั้งคำ
<input value="end" type="radio" name="match" />
ลงท้ายด้วย</td>
</tr>
<tr>
<td><div align="right"><strong>ประเภทปริญญานิพนธ์</strong> </div></td>
<td><select name="projecttype_id" id="projecttype_id" onchange="Listprojecttype(this.value)">
<option value="" selected="selected">ทุกประเภท</option>
<?
$sql_type ="select * from thesis_type";
mysql_query("SET NAMES UTF8");
$result_type = mysql_query($sql_type)or die(mysql_error());
while($row = mysql_fetch_array($result_type))
{
?>
<option value="<? echo $row['projecttype_id'];?>"><? echo $row['projecttype_name'];?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td><div align="right"><strong>ปีการศึกษา</strong> </div></td>
<td><select name="year_id1" id="year_id1">
<option value=""> ทุกปีการศึกษา </option>
<?
$sql_year ="select * from thesis_year";
mysql_query("SET NAMES UTF8");
$result_year = mysql_query($sql_year)or die(mysql_error());
while($row = mysql_fetch_array($result_year))
{
?>
<option value="<? echo $row['year_id'];?>"><? echo $row['year_name'];?></option>
<?
}
?>
</select>
ถึง
<select name="year_id2" id="year_id2">
<option value=""> ทุกปีการศึกษา </option>
<?
$sql_year ="select * from thesis_year";
mysql_query("SET NAMES UTF8");
$result_year = mysql_query($sql_year)or die(mysql_error());
while($row = mysql_fetch_array($result_year))
{
?>
<option value="<? echo $row['year_id'];?>"><? echo $row['year_name'];?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td> </td>
<td><span class="button_01" ><a href="">ค้นหา</a></span></td>
</tr>
</tbody>
</table>
<div align="center">
<p> </p>
<?
if(isset($a))
{
//user.username,member.id_card,member.name,member.pre_name,member.address,member.tel,member.province_id,province_tmp.province_name FROM user,member,province_tmp WHERE user.user_id=member.user_id AND member.province_id=province_tmp.province_id AND province_tmp.province_id = $a"//
$sql_show ="select thesis_name.pro_nameth,thesis_name.pro_nameeg,thesis_type.projecttype_name,thesis_year.year_name
FROM thesis,thesis_name,thesis_type,thesis_year
WHERE thesis.proname_id=thesis_name.proname_id AND thesis.projecttype_id=thesis_type.projecttype_id AND thesis.year_id=thesis_year.year_id AND thesis.project_id=thesis_type.projecttype_id=$a";
mysql_query("SET NAMES UTF8");
$result_show =mysql_query($sql_show) or die (mysql_error());
$row = mysql_num_rows($result_show);
if($row==0)
{
echo "<font color = red>ไม่พบข้อมูล</font>";
}
else
{
?>
</div>
<table width="670" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
<th width="40" bgcolor="#0099FF"><div align="center" class="style3">ลำดับ</div></th>
<th width="425" bgcolor="#0099FF"><div align="center" class="style3">ชื่อเรื่อง</div></th>
<th width="161" bgcolor="#0099FF"><div align="center" class="style3">ชื่อผู้แต่ง</div></th>
<th width="32" align="center" bgcolor="#0099FF">ปี</th>
</tr>
<?
include("../connection/connect.php");
$sql="select * from thesis inner join pro_developer on (thesis.project_id=pro_developer.project_id) inner join developer on (developer.student_id=pro_developer.student_id) inner join thesis_name on (thesis.proname_id=thesis_name.proname_id) inner join thesis_year ON (thesis.year_id=thesis_year.year_id) group by thesis.project_id";
mysql_query("SET NAMES UTF8");
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_num_rows($result) or die(mysql_error());
//echo $row;
$i=0;
while($fetch =mysql_fetch_array($result))
{
$project_id=$fetch['project_id'];
$project_name=$fetch['pro_nameth'];
$name= $fetch['lead_name'] . " " . $fetch['first_name'] . " " . $fetch['ser_name'];
$year_name=$fetch['year_name'];
?>
<tr onMouseOver="this.bgColor='#ff0000'" onMouseOut="this.bgColor='#0000ff'">
<td align="center" bgcolor="#CAEAFF"><span class="style5"><? echo $project_id ?></span>
<div align="center" class="style5"></div>
<div align="center" class="style5"></div></td>
<td bgcolor="#CAEAFF"><a href="../client/show_thesis.php?id_thesis=<? echo $project_id?>" class="style5"><? echo $project_name ?></a></td>
<td bgcolor="#CAEAFF"><span class="style5"><? echo $name ?></span></td>
<td bgcolor="#CAEAFF"><? echo $year_name ?></td>
</tr>
<?
$i++;
}
}
}
?>
</table>
</div>
</form>
<p> </p>
<!-- InstanceEndEditable -->
<div class="cleaner"></div>
<div class="button_01"><!-- InstanceBeginEditable name="pic" --><img src="/images/images/text_edit.png" width="83" height="77" align="right" /><!-- InstanceEndEditable --></div>
</div>
<!-- InstanceBeginEditable name="buttonn" -->
<div class="cleaner_h40">
<div class="button_01"></div>
</div>
<!-- InstanceEndEditable -->
<div class="content_section"><!-- InstanceBeginEditable name="conten2" --><!-- InstanceEndEditable -->
<p> </p>
</div>
</div>
<!-- end of content --><!-- end of sidebar -->
<div class="cleaner">
<div class="cleaner">
<div align="right"> <img src="/images/images/ic.gif" width="170" height="125" /></div>
</div>
</div>
</div>
<!-- end of content_wrapper -->
<div id="footer">
<ul class="footer_menu">
<li>Copyright © 2555<a href="http://www.rmutr.ac.th/"> Copyright by Rajamangala University of Techonology Rattanakosin<br />
</a>@
สาขาวิชาเทคโนโลยีสารสนเทศทางธุรกิจ</li></ul>
</div>
<!-- end of footer -->
</body>
<!-- InstanceEnd --></html>
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, C#
|
ประวัติการแก้ไข 2012-05-09 05:54:04
|
|
|
|
|
Date :
2012-05-09 05:53:12 |
By :
kankanit |
View :
1038 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แค่ออกแบบ Form ครับ สำหรับการค้นหาให้ใช้แบบนี้ครับ
Code (PHP)
<?
$strSQL = "SELECT * FROM table WHERE 1 ";
if($_POST["txt1"] != "")
{
$strSQL .= " AND F1 = '".$_POST["txt1"]."' ";
}
if($_POST["txt2"] != "")
{
$strSQL .= " AND F2 = '".$_POST["txt2"]."' ";
}
?>
|
|
|
|
|
Date :
2012-05-09 06:07:30 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|