|
|
|
jquery tab php+mysql+search ปัญหาการกดปุ่ม submit จากการค้นหาข้อมูลแต่ละเเท็บ |
|
|
|
|
|
|
|
report08
<? include"connect.php";?>
<? include"script.php";?>
<form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<br><br>
<table style="font-family:Verdana, Geneva, sans-serif; font-size:12px;" align="center">
<tr>
<th>สต็อก ณ.วันที่ :</th>
<td><input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_POST["txtKeyword"];?>"></td>
<td><button type="submit" value="บันทึก"><img src="image/search1.png" height="20" />ค้นหา</button></td>
<!-- <td><b>ยี่ห้อ :</b>
<select id="txtbrand" name="txtbrand">
<option value="">------------เลือก-----------</option>
<?
$strSQL = "SELECT brand_id,brand_name FROM brand ORDER BY CONVERT(brand_id USING TIS620) ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
if($strDefault == $objResuut["brand_id"])
{
$sel = "selected";
}else
{
$sel = "";
}
?>
<option value="<?=$objResuut["brand_id"];?>" <?=$sel;?>><?=$objResuut["brand_name"];?></option>
<?
}
?>
</select>
</td>
<td> <b>รุ่น :</b></td>
<td>
<select id="txtclass" name="txtclass">
<option value="">------------เลือก-----------</option>
<?
$strSQL = "SELECT * FROM class ORDER BY class_no ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
if($strDefault == $objResuut["class_id"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$objResuut["class_id"];?>" <?=$sel;?>><?=$objResuut["class_name"];?></option>
<?
}
?>
</select>
<span id="waitClass"></span>
</td>
-->
</tr>
</table>
</form>
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("motor");
$datetran = $_POST["txtKeyword"];
$dd = substr($datetran,0,2);
$mm = substr($datetran,3,2);
$yy = substr($datetran,6,4);
$datec = $yy.'-'.$mm.'-'.$dd;
$strSQL = "SELECT * FROM stock
INNER JOIN brand b ON b.brand_id = stock.brand
INNER JOIN class c ON c.class_id = stock.class
WHERE 1 ";
if($_POST["$txtKeyword"] == "")
{
$strSQL .= " AND (datetran <= '$datec' ) ";
}/*
if($_POST["txtbrand"] != "")
{
$strSQL .= " AND (brand = '".$_POST["txtbrand"]."') ";
}
if($_POST["txtclass"] != "")
{
$strSQL .= " AND (class = '".$_POST["txtclass"]."') ";
}*/
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$num = mysql_num_rows($objQuery);
?>
<table style="font-family:Verdana, Geneva, sans-serif; font-size:12px;" border="1" align="center" width="100%">
<tr height="45" bgcolor="#CCCCCC">
<th width="50"> <div align="center">ลำดับ </div></th>
<th width="200"> <div align="center">เลขเครื่อง </div></th>
<th width="200"> <div align="center">เลขถัง </div></th>
<th width="100"> <div align="center">ยี่ห้อ </div></th>
<th width="100"> <div align="center">รุ่น </div></th>
<th width="100"> <div align="center">สี </div></th>
<th width="100"> <div align="center">วันที่</div></th>
<th width="100"> <div align="center">สถานะ</div></th>
</tr>
<?
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
if($i%2==0)
{
$bg = "#FFFFFF";
}
else
{
$bg = "#CCFF99";
}
$class_name = $objResult["class_name"];
$brand_name = $objResult["brand_name"];
$color = $objResult["color"];
$color1 = $objResult["color1"];
$status_mt = $objResult["status_mt"];
$datetran = $objResult["datetran"];
$datetran1 = $objResult["datetran"];
$dd = substr($datetran,8,2);
$mm = substr($datetran,5,2);
$yy = substr($datetran,0,4);
$yy = $yy+543;
$datetran = $dd.'/'.$mm.'/'.$yy;
if($status_mt == 'P')
{
$status_mt = 'รอประเมิน';
}else
{
}
?>
<tr bgcolor="<?=$bg;?>" height="35">
<td align="center"><?=$i;?>.</td>
<td align="left"><?=$objResult["machine_id"];?></td>
<td align="left"><?=$objResult["chassis_id"];?></td>
<td><?=$brand_name;?></td>
<td><?=$class_name;?></td>
<td><?=$color;?>/<?=$color1;?></td>
<td><?=$datetran;?></td>
<td align="center"><?=$status_mt;?></td>
</tr>
<?
}
?>
<tr bgcolor="#CCCCCC" height="40">
<th colspan="6" align="center">รวมทั้งหมด</th>
<th align="center"><?=$num;?></th>
<th colspan="2" align="center">คัน</th>
</tr>
</table>
<script type="text/javascript">
function OpenReport() {
var myWindow=window.open("report09.pdf?datetran<=<?=$datec;?>",'windowRef','width=1600,height=900');
if (!myWindow.opener) myWindow.opener = self;
}
</script>
<? include"report09.php";?>
<button type="button" onClick="Javascript:OpenReport();"/><img src="image/print.png" width="18" height="18" />พิมพ์รายงาน</button>
<?
mysql_close($objConnect);
?>
report10
<? include"connect.php";?>
<? include"script.php";?>
<form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<br><br>
<table style="font-family:Verdana, Geneva, sans-serif; font-size:12px;" align="center">
<tr>
<th>สต็อก ณ.วันที่ :</th>
<td><input name="txtKeyword1" type="text" id="txtKeyword1" value="<?=$_POST["txtKeyword"];?>"></td>
<td><button type="submit" value="บันทึก"><img src="image/search1.png" height="20" />ค้นหา</button></td>
</tr>
</table>
</form>
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("motor");
$datetran = $_POST["txtKeyword"];
$dd = substr($datetran,0,2);
$mm = substr($datetran,3,2);
$yy = substr($datetran,6,4);
$datec = $yy.'-'.$mm.'-'.$dd;
$strSQL = "SELECT * FROM stock
INNER JOIN brand b ON b.brand_id = stock.brand
INNER JOIN class c ON c.class_id = stock.class
WHERE status_mt = 'O' ";
if($_POST["$txtKeyword"] == "")
{
$strSQL .= " AND (datetran <= '$datec' ) ";
}/*
if($_POST["txtbrand"] != "")
{
$strSQL .= " AND (brand = '".$_POST["txtbrand"]."') ";
}
if($_POST["txtclass"] != "")
{
$strSQL .= " AND (class = '".$_POST["txtclass"]."') ";
}*/
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$num = mysql_num_rows($objQuery);
?>
<table style="font-family:Verdana, Geneva, sans-serif; font-size:12px;" border="1" align="center" width="100%">
<tr height="45" bgcolor="#CCCCCC">
<th width="50"> <div align="center">ลำดับ </div></th>
<th width="200"> <div align="center">เลขเครื่อง </div></th>
<th width="200"> <div align="center">เลขถัง </div></th>
<th width="100"> <div align="center">ยี่ห้อ </div></th>
<th width="100"> <div align="center">รุ่น </div></th>
<th width="100"> <div align="center">สี </div></th>
<th width="100"> <div align="center">วันที่</div></th>
<th width="100"> <div align="center">สถานะ</div></th>
</tr>
<?
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
if($i%2==0)
{
$bg = "#FFFFFF";
}
else
{
$bg = "#CCFF99";
}
$class_name = $objResult["class_name"];
$brand_name = $objResult["brand_name"];
$color = $objResult["color"];
$color1 = $objResult["color1"];
$status_mt = $objResult["status_mt"];
$datetran = $objResult["datetran"];
$datetran1 = $objResult["datetran"];
$dd = substr($datetran,8,2);
$mm = substr($datetran,5,2);
$yy = substr($datetran,0,4);
$yy = $yy+543;
$datetran = $dd.'/'.$mm.'/'.$yy;
if($status_mt == 'P')
{
$status_mt = 'รอประเมิน';
}else
{
}
?>
<tr bgcolor="<?=$bg;?>" height="35">
<td align="center"><?=$i;?>.</td>
<td align="left"><?=$objResult["machine_id"];?></td>
<td align="left"><?=$objResult["chassis_id"];?></td>
<td><?=$brand_name;?></td>
<td><?=$class_name;?></td>
<td><?=$color;?>/<?=$color1;?></td>
<td><?=$datetran;?></td>
<td align="center"><?=$status_mt;?></td>
</tr>
<?
}
?>
<tr bgcolor="#CCCCCC" height="40">
<th colspan="6" align="center">รวมทั้งหมด</th>
<th align="center"><?=$num;?></th>
<th colspan="2" align="center">คัน</th>
</tr>
</table>
<script type="text/javascript">
function OpenReport11() {
var myWindow=window.open("report11.pdf?datetran<=<?=$datec;?>",'windowRef','width=1600,height=900');
if (!myWindow.opener) myWindow.opener = self;
}
</script>
<? include"report11.php";?>
<button type="button" onClick="Javascript:OpenReport11();"/><img src="image/print.png" width="18" height="18" />พิมพ์รายงาน</button>
<?
mysql_close($objConnect);
?>
|
|
|
|
|
Date :
2013-07-04 15:14:43 |
By :
PALM26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองส่ง url ตัว tab มาครับ เช่น index.php?tab=tab1
Code (PHP)
var focus_tab = "<?=$_GET['tab'];?>";
$(".tabs").tabs();
if(focus_tab == "tab1"){
$(".tabs").tabs("select", "#tab1");
}else if(focus_tab == "tab2"){
$(".tabs").tabs("select", "#tab2");
}else if(focus_tab == "tab3"){
$(".tabs").tabs("select", "#tab3");
}
|
|
|
|
|
Date :
2013-07-04 15:20:14 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ไม่ถูกอ้ะค้ะ...แต่ว่าได้แบบไหม่แล้ว
Code (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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery</title>
<style>
body { margin:10px 40px; font-family:Tahoma, Geneva, sans-serif;}
#header { height:100px; border-bottom:1px solid #FFFFFF; margin-bottom:40px;}
h2 { color:bisque;}
#dl { position:absolute; left:0; top:400px; margin-left:40px;}
#display { width:900px; height:20px;}
#tab { width:900px; font-size:0.8em;}
img { margin-bottom:10px;}
</style>
</head>
<body>
<div id="display"></div>
<div id="tab">
<ul>
<li><a href="#tab1">สต๊อกรวม</a></li>
<li><a href="#tab2">สโตร์รอประเมิน</a></li>
<li><a href="#tab3">สโตร์ออฟไลน์</a></li>
<li><a href="#tab4">สโตร์ QC</a></li>
<li><a href="tabs.html">สโตร์รถซาก</a></li>
<li><a href="file.html">สโตร์รอส่งสาขา</a></li>
</ul>
<div id="tab1"><? include"report08.php";?></div>
<div id="tab2"><? include"report10.php";?></div>
<div id="tab3">content_3</div>
<div id="tab4">content_4</div>
</div>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<link rel="stylesheet" type="text/css" href="ui-lightness/jquery-ui-1.8.21.custom.css" />
<script type="text/javascript">
$(document).ready(function(){
$('#tab').tabs({
ajaxOptions: {
error: function(xhr,index,status,anchor) {
$(anchor.hash).text('load error');
}
},
//event: 'mouseover',
collapsible: true,
cookie: {expires: 1}
}).find('.ui-tabs-nav').sortable({axis: 'x'});
});
</script>
</body>
</html>
|
|
|
|
|
Date :
2013-07-04 16:46:14 |
By :
PALM26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2013-07-04 17:36:07 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|