|
 |
|
ขอ code ค้นหาข้อมูล แบบ list box เดือน ปี จากฐานข้อมูล แล้วให้แสดงข้อมูลที่ค้นหาเจอ จากเดือนและปี ที่ค้นหา หริอ code ที่คล้ายๆๆกัน |
|
 |
|
|
 |
 |
|
php + mysqlCode (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL="SHORTCUT ICON" HREF="http://23.168.213.73/phone_wndc/img/pda.ico" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="css/moodalbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/moodalbox.js"></script>
<style type="text/css" media="screen">@import url(css/niceforms-red.css);body {
margin-left: 0px;
margin-top: 40px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
<title>Telephone Directory Wangnoi DC</title>
</head>
<style>
.style8 {
font-family: Tahoma;
font-size: 11px;
}
.style2 {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
}
.style3 {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #FF0000;
}
A:link {text-decoration: none; Color: #3399FF}
A:visited {text-decoration: none; Color: #3399FF}
A:hover {text-decoration: none; font-weight: underline; Color: #FF3300}
</style>
<body bottommargin="0" topmargin="40" leftmargin="0" rightmargin="0" >
<table width="975" border="0" align="center">
<tr>
<td width="149">
<font face="Tahoma" color="#FF3300" size="2">
<b><a href="http://23.168.213.73/phone_wndc">[ BiG C Wangnoi ] |</a></b></font><span class="style15"></span>
</td>
<td width="181"><font face="Tahoma" color="#FF3300" size="2">
<b><a href="http://23.168.213.73/phone_wndc/transport.php">[ Transport Wangnoi ] |</a></b></font>
</td>
<td width="631"><font face="Tahoma" color="#FF3300" size="2">
<b><a href="http://23.168.213.73/phone_wndc/emergency.php">[ Emergency Number ]</a></b></font>
</td></tr>
</table>
<!-- Table 1 เส้นรอบนอกสีฟ้า -->
<table border="0" cellspacing="1" cellpadding="0" bgcolor="#9cbee6" align="center">
<tr>
<td width="975">
<!-- Table 1 เส้นรอบนอกสีฟ้า -->
<table width="975" border="0" align="center" cellpadding="8" cellspacing="0" bgcolor="#ffffff">
<tr>
<td width="975">
<table borderColor="#ffffff" cellSpacing="0" cellPadding="2" border="1" align="center">
<tr><td>
<!-- Header DHL SUPPLY CHAIN -->
<table width="950" border="0" align="center">
<tr>
<td><font color="#000000" face="Tahoma" size="2"><b>Telephone Directory (Big C Wangnoi DC)</b></font></td>
</tr>
</table>
<?
$fields =$_POST[fields];
$keyword=$_POST[keyword];
if (empty($keyword) or empty($fields))
{
?>
<form name="form2" method="post" action="search.php">
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR><TD>
<TABLE width="750" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD width="202" BGCOLOR="#FFFFFF"><div align="left"><b><font size="-7" face="Verdana"> </font></b></div></TD>
<TD width="290" BGCOLOR="#FFFFFF"><div align="right"><b><font size="-7" face="Verdana">
<select name="fields">
<option value="b.sub_name">Dept.</option>
<option value="a.emp_nameeng">ชื่อ-สกุล</option>
</select> </font></b></div>
</TD>
<TD width="194" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="text" name="keyword" id="keyword">
<span class="style3">%=All</span></div>
</font></b>
</TD>
<TD width="54" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="submit" class="buttonstyle" name="Submit" value="ค้นหา" title="Search Telephone Directory BigC & Transport"></div>
</font></b>
</TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
</form>
<?
exit();
}
else
{
require_once('../Connections/con_msql_itapp.php');
$sql="select a.emp_nameeng,a.emp_position,a.emp_dline,a.emp_extno,b.sub_name
from wn_employees a,wn_subdept b where $fields like '%$keyword%'
and a.sub_id = b.sub_id
order by b.sub_id";
$db_query=mysql_db_query($database_con_msql_itapp,$sql);
$num_rows=mysql_num_rows($db_query);
if(empty($num_rows))
{
?>
<form name="form2" method="post" action="search.php">
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR><TD>
<TABLE width="750" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD width="202" BGCOLOR="#FFFFFF"><div align="left"><b><font size="-7" face="Verdana"> </font></b></div></TD>
<TD width="290" BGCOLOR="#FFFFFF"><div align="right"><b><font size="-7" face="Verdana">
<select name="fields">
<option value="b.sub_name">Dept.</option>
<option value="a.emp_nameeng">ชื่อ-สกุล</option>
</select> </font></b></div>
</TD>
<TD width="194" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="text" name="keyword" id="keyword">
<span class="style3">%=All</span></div>
</font></b>
</TD>
<TD width="54" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="submit" class="buttonstyle" name="Submit" value="ค้นหา" title="Search Telephone Directory BigC & Transport"></div>
</font></b>
</TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
</form>
<?
echo"<br><br><br><center><div class=\"style8\">ไม่พบข้อมูล</div><div class=\"style10\"><b>$keyword</div></b></center>";
exit();
}
else
{
?>
<form name="form2" method="post" action="search.php">
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR><TD>
<TABLE width="750" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD width="202" BGCOLOR="#FFFFFF"><div align="left"><b><font size="-7" face="Verdana"> </font></b></div></TD>
<TD width="290" BGCOLOR="#FFFFFF"><div align="right"><b><font size="-7" face="Verdana">
<select name="fields">
<option value="b.sub_name">Dept.</option>
<option value="a.emp_nameeng">ชื่อ-สกุล</option>
</select> </font></b></div>
</TD>
<TD width="194" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="text" name="keyword" id="keyword">
<span class="style3">%=All</span></div>
</font></b>
</TD>
<TD width="54" BGCOLOR="#FFFFFF"><b><font size="-7" face="Verdana">
<div align="left"><input type="submit" class="buttonstyle" name="Submit" value="ค้นหา" title="Search Telephone Directory BigC & Transport"></div>
</font></b>
</TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
</form>
<table width="950" border="0">
<tr width="950">
<td width="53" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">ลำดับที่</span></div>
</td>
<td width="93" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">ชื่อ-สกุล</span></div>
</td>
<td width="106" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">ตำแหน่ง</span></div>
</td>
<td width="97" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">Direct line</span></div>
</td>
<td width="65" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">Ext.No</span></div>
</td>
<td width="274" bgcolor="#006699"><div align="center" class="style2">
<span class="style5">แผนก</span></div>
</td>
</tr>
<?
$a=0;
while($a < $num_rows)
{
$result = mysql_fetch_array($db_query);
$emp_nameeng=$result[emp_nameeng];
$emp_position=$result[emp_position];
$emp_dline=$result[emp_dline];
$emp_extno=$result[emp_extno];
$sub_name=$result[sub_name];
if($a%2==0){
$bgcolor="#BCCCDA";
}else{
$bgcolor="#EEF2F7";
}
$a++;
echo "<tr bgcolor=$bgcolor> ";
echo "<td width=\"53\" align=\"center\" class=\"style8\"> $a</td>";
echo "<td width=\"420\" align=\"\" class=\"style8\"> $emp_nameeng</td>";
echo "<td width=\"400\" align=\"\" class=\"style8\"> $emp_position</td>";
echo "<td width=\"200\" align=\"\" class=\"style8\"> $emp_dline</td>";
echo "<td width=\"100\" align=\"center\" class=\"style8\"> $emp_extno</td>";
echo "<td width=\"200\" align=\"\" class=\"style8\"> $sub_name</td>";
?>
</tr>
<?
}
}
}
?>
</table>
</tr>
</table>
</td></tr></table>
<!-- End Table 1 เส้นรอบนอกสีฟ้า -->
<!-- End Table 1 เส้นรอบนอกสีฟ้า -->
<!-- Header DHL SUPPLY CHAIN -->
<table width="950" border="0" align="center">
<tr>
<td><div align="right"><font size="-7" face="Verdana">All Content @ Copyright 2010 DCwn DHL,Inc, All rights reserved</font></div></td>
</tr>
</table>
</td></tr></table>
</body>
</html>
เอาไปดัดแปลงดูนะ
|
 |
 |
 |
 |
Date :
2010-08-02 08:29:05 |
By :
xcom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|