search order ที่ลูกค้าสั่งซื้อ
โค๊ด:
<?
session_start();
session_destroy();
$searchID=$_GET['searchID'];
$input = "";
if(strcmp($searchID,"1")==0)
{
$input = "<form action="customer_search.php?searchID=1" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากชื่อบริษัท : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
else if(strcmp($searchID,"2")==0)
{
$input = "<form action="customer_search.php?searchID=2" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากชื่อผู้ติดต่อ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
else if(strcmp($searchID,"3")==0)
{
$input = "<form action="customer_search.php?searchID=3" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากที่อยู่ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ระบบค้นหาลูกค้า</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #CEF3FF;
}
.nornal_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
}
-->
</style>
<script type="text/javascript">
function test()
{
alert("Palm");
}
function companyName()
{
var text = "<label>ค้นหาจากเลขที่ใบรับคำสั่งซื้อ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button_submit" value="ค้นหา" OnClick="JavaScript:doCallAjax('order_id');" /></label>";
document.getElementById("SearchForm").innerHTML = text;
}
function contactName()
{
var text = "<label>ค้นหาจากชื่อลูกค้า : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button_submit" value="ค้นหา" OnClick="JavaScript:doCallAjax('com_name');" /></label>";
document.getElementById("SearchForm").innerHTML = text;
}
//Ajax code
var HttPRequest = false;
function doCallAjax(field) {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'script_search_order.php';
//var select_value = field "='%" document.getElementById("data").value "%'";
//alert(select_value);
var pmeters ="";
if(field=="blank")
{
pmeters = "mySort=blank";
}
else if(field=="order_id")
{
var order_id = document.getElementById("data").value;
pmeters = "mySort=" field "&data=" order_id;
}
else
{
pmeters = "mySort=" field "&data=" document.getElementById("data").value;
}
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.setRequestHeader("Connection", "close");
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("data").value="";
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
}
</script>
</head>
<body onload="javascript:companyName()">
<table width="800" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#3399ff" bgcolor="#FFFFFF">
<tr>
<td><img src="../images/title.jpg" width="800" height="120" /></td>
</tr>
<tr>
<td><table width="800" border="0" cellpadding="0" cellspacing="0" class="nornal_text">
<tr>
<td> </td>
</tr>
<tr>
<td>ค้นหาจาก <a href="javascript:companyName()">เลขที่ใบรับคำสั่งซื้อ</a> |<a href="javascript:contactName()">ชื่อลูกค้า </a>| <a href="javascript:doCallAjax('blank')">แสดงทั้งหมด</a> | <a href="../index.php" target="_self">เมนูหลัก </a></td>
</tr>
<tr>
<td id="SearchForm"><div><? print $input; ?></div></td>
</tr>
<tr>
<td><div align="right"><img src="../images/save.jpg" width="26" height="25" /> = บันทึกใบรับคำสังซื้อสินค้า <img src="../images/detail.jpg" width="23" height="25" /> = ดูรายละเอียดลูกค้า</div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td id="mySpan"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</body>
</html>
session_start();
session_destroy();
$searchID=$_GET['searchID'];
$input = "";
if(strcmp($searchID,"1")==0)
{
$input = "<form action="customer_search.php?searchID=1" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากชื่อบริษัท : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
else if(strcmp($searchID,"2")==0)
{
$input = "<form action="customer_search.php?searchID=2" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากชื่อผู้ติดต่อ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
else if(strcmp($searchID,"3")==0)
{
$input = "<form action="customer_search.php?searchID=3" method="post" name="search_form" target="_self" id="search_form"><label>ค้นหาจากที่อยู่ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button" value="ค้นหา" /></label></form>";
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ระบบค้นหาลูกค้า</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #CEF3FF;
}
.nornal_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
}
-->
</style>
<script type="text/javascript">
function test()
{
alert("Palm");
}
function companyName()
{
var text = "<label>ค้นหาจากเลขที่ใบรับคำสั่งซื้อ : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button_submit" value="ค้นหา" OnClick="JavaScript:doCallAjax('order_id');" /></label>";
document.getElementById("SearchForm").innerHTML = text;
}
function contactName()
{
var text = "<label>ค้นหาจากชื่อลูกค้า : <input type="text" name="data" id="data" /></label><label><input type="submit" name="button" id="button_submit" value="ค้นหา" OnClick="JavaScript:doCallAjax('com_name');" /></label>";
document.getElementById("SearchForm").innerHTML = text;
}
//Ajax code
var HttPRequest = false;
function doCallAjax(field) {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'script_search_order.php';
//var select_value = field "='%" document.getElementById("data").value "%'";
//alert(select_value);
var pmeters ="";
if(field=="blank")
{
pmeters = "mySort=blank";
}
else if(field=="order_id")
{
var order_id = document.getElementById("data").value;
pmeters = "mySort=" field "&data=" order_id;
}
else
{
pmeters = "mySort=" field "&data=" document.getElementById("data").value;
}
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.setRequestHeader("Connection", "close");
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("data").value="";
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
}
</script>
</head>
<body onload="javascript:companyName()">
<table width="800" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#3399ff" bgcolor="#FFFFFF">
<tr>
<td><img src="../images/title.jpg" width="800" height="120" /></td>
</tr>
<tr>
<td><table width="800" border="0" cellpadding="0" cellspacing="0" class="nornal_text">
<tr>
<td> </td>
</tr>
<tr>
<td>ค้นหาจาก <a href="javascript:companyName()">เลขที่ใบรับคำสั่งซื้อ</a> |<a href="javascript:contactName()">ชื่อลูกค้า </a>| <a href="javascript:doCallAjax('blank')">แสดงทั้งหมด</a> | <a href="../index.php" target="_self">เมนูหลัก </a></td>
</tr>
<tr>
<td id="SearchForm"><div><? print $input; ?></div></td>
</tr>
<tr>
<td><div align="right"><img src="../images/save.jpg" width="26" height="25" /> = บันทึกใบรับคำสังซื้อสินค้า <img src="../images/detail.jpg" width="23" height="25" /> = ดูรายละเอียดลูกค้า</div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td id="mySpan"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</body>
</html>