|
|
|
ทำไมเวลา preview ข้อมูลดูบนเว็บ แล้วมันชอบขึ้นหน้าเปล่าครับ บางทีก็ขึ้นข้อมูลแต่ต้อง refresh บ่อย ๆ |
|
|
|
|
|
|
|
คำสั่งก็ถูกนะครับ แต่บางทีต้อง refresh บ่อย ๆ มันเปนเพราะอะไรหลอครับ
Code (PHP)
<?php require_once('Connections/ConnectSW.php'); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ThaiCreate.Com ListMenu</title>
<script language = "JavaScript">
//**** List Province (Start) ***จังหวัด//
function ListProvince(SelectValue)
{
frmMain.ddlProvince.length = 0
frmMain.ddlAmphur.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
<?php
$intRows = 0;
$strSQL1 = "SELECT * FROM car ORDER BY brand_car ASC";
$objQuery1 = mysql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
$intRows = 0;
while($objResult1 = mysql_fetch_array($objQuery1))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$objResult1["brand_car"];?>";
strValue = "<?=$objResult1["gene_car"];?>";
mySubList[x,0] = strGroup;
mySubList[x,1] = strValue;
if (mySubList[x,0] == SelectValue){
var myOption = new Option(mySubList[x,1])
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
}
<?php
}
?>
}
//**** List Province (End) ***//
//**** List Amphur (Start) ***อำเภอ//
function ListAmphur(SelectValue)
{
frmMain.ddlAmphur.length = 0
frmMain.ddldistrict.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
<?php
$intRows = 0;
$strSQL1 = "SELECT * FROM car ORDER BY brand_car ASC";
$objQuery1 = mysql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
$intRows = 0;
while($objResult1 = mysql_fetch_array($objQuery1))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$objResult1["gene_car"];?>";
strValue = "<?=$objResult1["year_car"];?>";
mySubList[x,0] = strGroup;
mySubList[x,1] = strValue;
if (mySubList[x,0] == SelectValue){
var myOption = new Option(mySubList[x,1])
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
}
<?php
}
?>
}
//**** List Amphur (End) ***อำเภอ//
//**** List District (Start) *** ตำบล//
function Listdistrict(SelectValue)
{
frmMain.ddldistrict.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddldistrict.options[frmMain.ddldistrict.length]= myOption
<?php
$intRows = 0;
$strSQL1 = "SELECT * FROM car ORDER BY year_car ASC";
$objQuery1 = mysql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
$intRows = 0;
while($objResult1 = mysql_fetch_array($objQuery1))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$objResult1["brand_car"];?>";
strValue = "<?=$objResult1["year_car"];?>";
mySubList[x,0] = strGroup;
mySubList[x,1] = strValue;
if (mySubList[x,0] == SelectValue){
var myOption = new Option(mySubList[x,1])
frmMain.ddldistrict.options[frmMain.ddldistrict.length]= myOption
}
<?php
}
?>
}
//**** List District (End) ***ตำบล//
</script>
</head>
<form name="frmMain" action="" method="post">
Geography
<select id="ddlGeo" name="ddlGeo" onChange = "ListProvince(this.value)">
<option value="" hidden=""><-- เลือกรหัส --></option>
<?php
$strSQL1 = "SELECT DISTINCT brand_car FROM car ORDER BY brand_car ASC";
$objQuery1 = mysql_query($strSQL1);
while($objResult1 = mysql_fetch_array($objQuery1))
{
?>
<option value="<?php echo $objResult1["brand_car"];?>"><?php echo $objResult1["brand_car"];?></option>
<?php
}
?>
</select>
Province
<select id="ddlProvince" name="ddlProvince" style="width:120px" onChange = "ListAmphur(this.value)"></select>
Amphur
<select id="ddlAmphur" name="ddlAmphur" style="width:200px" onChange = "Listdistrict(this.value)"></select>
District
<select id="ddldistrict" name="ddldistrict" style="width:200px"></select>
</form>
</body>
</html>
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2016-12-15 20:48:49
|
|
|
|
|
Date :
2016-12-15 20:38:14 |
By :
tomzone2 |
View :
766 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
น่าจะมีตัวอย่าง code มาให้หน่อยนะ
|
|
|
|
|
Date :
2016-12-15 20:48:12 |
By :
Who am i |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อาจเป็นเพราะ การ ดึงข้อมูลมาแสดงรึป่าว ไม่ก็ server ช้า
|
|
|
|
|
Date :
2016-12-15 20:48:58 |
By :
Who am i |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2016-12-16 09:07:21 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|