|
|
|
ช่วยหน่อยนะคะ ภาพ Loading เวลาประมวลผล ไม่แสดงค่ะ ไม่รู็ว่ามันผิดตรงไหน ช่วยหน่อยนะคะ |
|
|
|
|
|
|
|
คือว่า พอหนูรันบน windows ie version 8 มันรันได้ค่ะ แต่พอเป็น version ที่มากกว่า ภาพมันไม่แสดง จะแก้ยังไงดีค่ะ หนู่เองก็พึ่งหัดเขียน ช่วยดูหน่อยนะคะ
Code (PHP)
<?php
require_once('_connections/conPG.php');
include('_function/phpFunction.php');
$dd1="select min(registdate) as aa from maindata3 where area='$area' and hmain='$hmain'";
//echo $dd1."<br>";
$rs_dd1=$conPG->Execute($dd1) or die ($conPG->ErrorMSG());
while(!$rs_dd1->EOF){
$mindate =$rs_dd1->Fields('aa');
$rs_dd1->MoveNext();
}
$dd2="select max(registdate) as aa from maindata3 where area='$area' and hmain='$hmain'";
$rs_dd2=$conPG->Execute($dd2) or die ($conPG->ErrorMSG());
while(!$rs_dd2->EOF){
$maxdate =$rs_dd2->Fields('aa');
$rs_dd2->MoveNext();
}
$kk="select * from hospital where hmain='$hmain'";
$rs_kk=$conPG->Execute($kk) or die ($conPG->ErrorMSG());
while(!$rs_kk->EOF){
$nnhos =$rs_kk->Fields('namehos');
$rs_kk->MoveNext();
}
if (isset($_GET['chk_pg'])) { $chk_pg=$_GET['chk_pg']; }else {$chk_pg='';}
$fMonth=array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
if (isset($_POST['sday'])){$sday=trim($_POST['sday']); }
else if(isset($_GET['sday'])){$sday=trim($_GET['sday']); }
else {$sday=date('d');}
if (isset($_POST['smon'])){$smon=trim($_POST['smon']); }
else if(isset($_GET['smon'])){$smon=trim($_GET['smon']); }
else {$smon=date('m');}
if (isset($_POST['syear'])){$syear=trim($_POST['syear']); }
else if(isset($_GET['syear'])){$syear=trim($_GET['syear']); }
else {$syear=date('Y')+543;}
if (isset($_POST['sday2'])){ $sday2=trim($_POST['sday2']); }
else if(isset($_GET['sday2'])){ $sday2=trim($_GET['sday2']); }
else {$sday2=date('d');}
if (isset($_POST['smon2'])){$smon2=trim($_POST['smon2']); }
else if(isset($_GET['smon2'])){$smon2=trim($_GET['smon2']); }
else {$smon2=date('m');}
if (isset($_POST['syear2'])){ $syear2=trim($_POST['syear2']); }
else if(isset($_GET['syear2'])){ $syear2=trim($_GET['syear2']); }
else {$syear2=date('Y')+543;}
$sDate1=$syear.$smon.$sday;
$eDate2=$syear2.$smon2.$sday2;
$sday8=substr($sDate1,6,2);
$smon8=substr($sDate1,4,2);
$syear8=substr($sDate1,0,4);
$sday82=substr($eDate2,6,2);
$smon82=substr($eDate2,4,2);
$syear82=substr($eDate2,0,4);
$ssum_s1=0;$ssum_s2=0;$ssum_s3=0;$ssum_s4=0;$ssum_s5=0;$ssum_all=0;
if (isset($_POST['hmain']))
{$hmain_id2=trim($_POST['hmain']); }
else if(isset($_GET['hmain'])){$hmain_id2=trim($_GET['hmain']); }
else {$hmain_id2='';}
if($chk_pg=="P"){ //ประมวลผล
//echo "Hmain->".$hmain_id2."<br>";
//echo "sDate1->".$sDate1."<br>";
//echo "eDate2->".$eDate2."<br>";
$ddell7="delete from maindata3 where hmain='$hmain'";
//echo $ddell7."<br>";
$rs_ddell7=$conPG->Execute($ddell7) or die ($conPG->ErrorMSG());
$n_qq="select m.cid,m.hmain,count(m.cid) as ab ";
$n_qq.="from maindata m ";
$n_qq.="left join hospital h on h.hmain=m.hmain ";
$n_qq.="where m.registdate between '$sDate1' and '$eDate2' ";
$n_qq.="and h.area='$area' ";
/* if(trim($hmain_id2)!=''){
$n_qq.="and m.hmain='$hmain_id2' ";
} */
$n_qq.="and m.hmain='$hmain' ";
$n_qq.="and m.scr!='0' ";
$n_qq.="group by m.cid,m.hmain ";
$n_qq.="order by m.cid desc ";
//echo $n_qq."<br>";
$rs_n3=$conPG->Execute($n_qq) or die ($conPG->ErrorMSG());
$req_n3=pg_query($n_qq);
$num_n3=pg_num_rows($req_n3);
$numm=1;
if($num_n3!=0){
while(!$rs_n3->EOF){
$cid3 =$rs_n3->Fields('cid');
$hmain3 =$rs_n3->Fields('hmain');
$ab =$rs_n3->Fields('ab');
$qlim1="select * from maindata ";
$qlim1.="where registdate between '$sDate1' and '$eDate2' ";
$qlim1.="and hmain='$hmain3' ";
$qlim1.="and cid='$cid3' ";
$qlim1.="order by cid,registdate desc ";
$qlim1.="LIMIT 1 ";
$rs_n4=$conPG->Execute($qlim1) or die ($conPG->ErrorMSG());
while(!$rs_n4->EOF){
$hn3 =$rs_n4->Fields('hn');
$usedrg3 =$rs_n4->Fields('usedrg');
$sex3 =$rs_n4->Fields('sex');
$age3 =$rs_n4->Fields('age');
$dept3 =$rs_n4->Fields('dept');
$scr3 =$rs_n4->Fields('scr');
$hmain3 =$rs_n4->Fields('hmain');
$remark3 =$rs_n4->Fields('remark');
$dateinput3 =$rs_n4->Fields('dateinput');
$raya13 =$rs_n4->Fields('raya1');
$raya23 =$rs_n4->Fields('raya2');
$raya33 =$rs_n4->Fields('raya3');
$raya43 =$rs_n4->Fields('raya4');
$raya53 =$rs_n4->Fields('raya5');
$ckd_epinew3=$rs_n4->Fields('ckd_epinew');
$cala3 =$rs_n4->Fields('cala');
$calb3 =$rs_n4->Fields('calb');
$calc3 =$rs_n4->Fields('calc');
$cald3 =$rs_n4->Fields('cald');
$htdm3 =$rs_n4->Fields('htdm');
$status3 =$rs_n4->Fields('status');
$registdate3=$rs_n4->Fields('registdate');
$qns="insert into maindata3 ";
$qns.="(cid,sex,age,scr,dept,hn,usedrg,hmain,ckd_epinew,remark,";
$qns.="raya1,raya2,raya3,raya4,raya5,registdate,dateinput, ";
$qns.="cala,calb,calc,cald,htdm,status,area) values ( ";
$qns.="'$cid3','$sex3','$age3','$scr3',";
$qns.="'$dept3','$hn3','$usedrg3','$hmain3',$ckd_epinew3,'$remark3','$raya13',";
$qns.="'$raya23','$raya33','$raya43','$raya53','$registdate3','$dateinput3',";
$qns.="$cala3,$calb3,$calc3,$cald3,'$htdm3','$status3','$area') ";
$rs_n5=$conPG->Execute($qns) or die ($conPG->ErrorMSG());
//echo $numm."|".$qns."<br>";
$numm++;
$rs_n4->MoveNext();
}
$rs_n3->MoveNext();
}
}
echo '<table border=0>';
echo '<tr><td> </td></tr>';
echo '<tr><td> </td></tr>';
echo '<tr><td> </td></tr>';
echo '<tr><td class=FontSize14><font color=blue> ';
echo "ประมวลผลเรียบร้อย จำนวน ".number_format($numm-1)." รายการ";
echo '</font></td></tr>';
echo '<tr><td> </td></tr>';
echo '</table>';
exit;
}
?>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<script language="javascript" src="_functions/JavaFunction.js"></script>
<link href="../fontTahoma.css" rel="stylesheet" type="text/css">
<style type="text/css">
</style>
</HEAD>
<body bgcolor="#FFFFE6">
<form name="view_ket" method="POST" action="">
<input type="hidden" name="sDate1" id="ss" value="<?php echo $sDate1; ?>">
<input type="hidden" name="eDate2" id="ee" value="<?php echo $eDate2; ?>">
<table border="0" >
<th class="FontSize10B"><font color="blue"><U>การประมวลผลข้อมูล</U></font></th>
</table>
<table border="1" cellspacing="1" cellpadding="3">
<tr>
<td class="FontSize10" colspan="2">เลือกโรงพยาบาล</td>
<td colspan="8">
<select name="hmain" >
<option value=''>--ทั้งหมด--</option>
<?php
$qry_dept=" select * ";
$qry_dept.="from hospital ";
$qry_dept.="where area='$area' ";
$qry_dept.="order by hmain ";
$rs_dept=$conPG->Execute($qry_dept) or die ($conPG->ErrorMSG());
while(!$rs_dept->EOF){
$hmain_id = $rs_dept->Fields('hmain');
$hmain_des = $rs_dept->Fields('namehos');
?>
<option value="<?php echo $hmain_id ;?>" <?php if(trim($hmain_id)==$hmain) echo " selected"; ?>> <?php echo $hmain_id." - ".$hmain_des?></option>
<?php
$rs_dept->MoveNext();
}
?>
</select>
</td>
</tr>
<tr class="FontSize10">
<td width="50px">เริ่มวันที่</td>
<td>
<select name="sday" id="sday" >
<option value="00" selected>-วัน-</option>
<?php
$sVal='';
for ($i=1; $i<32; $i++)
{
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if (intval($sday)==intval($sVal)) { echo ' SELECTED'; }
echo '>'.intval($sVal).'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="smon" id="smon" >
<option value="00" selected>-เลือกเดือน-</option>
<?php
$sVal='';
for ($i=1; $i<13; $i++) {
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($smon==$sVal) { echo ' SELECTED'; }
echo '>'.$fMonth[intval($sVal)].'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="syear" id="syear" >
<option value="00" selected>-เลือกปี-</option>
<?php
$sVal='';
for ($i=0; $i<11; $i++) {
$sVal=date('Y')+(543-$i);
echo '<option value="'.$sVal.'"';
if ($syear==$sVal) { echo ' SELECTED'; }
echo '>'.$sVal.'</option>'."\n";
}
?>
</select>
</td>
<td width="50" class="FontSize10" align="center">ถึงวันที่</td>
<td>
<select name="sday2" id="sday2" >
<option value="00" selected>-วัน-</option>
<?php
$sVal='';
for ($i=1; $i<32; $i++)
{
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($sday2==$sVal) { echo ' SELECTED'; }
echo '>'.intval($sVal).'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="smon2" id="smon2" >
<option value="00" selected>-เลือกเดือน-</option>
<?php
$sVal='';
for ($i=1; $i<13; $i++) {
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($smon2==$sVal) { echo ' SELECTED'; }
echo '>'.$fMonth[intval($sVal)].'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="syear2" id="syear2" >
<option value="00" selected>-เลือกปี-</option>
<?php
$sVal='';
for ($i=0; $i<11; $i++) {
$sVal=date('Y')+(543-$i);
echo '<option value="'.$sVal.'"';
if ($syear2==$sVal) { echo ' SELECTED'; }
echo '>'.$sVal.'</option>'."\n";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="8" align="left" class="FontSize10"><font color="blue">
<input type="button" value="***ประมวลผล***" onclick="getData_process()" style="width:130px;">
ประมวลผลล่าสุด
<?php echo $nnhos; ?>
<?php echo iconv('TIS-620','UTF-8',thaidate($mindate)); ?> ถึง
<?php echo iconv('TIS-620','UTF-8',thaidate($maxdate)); ?>
</font>
</td>
</tr>
</table>
<div id="targetDiv"></div>
</form>
</body>
</html>
<script language="javascript">
var objRequest = createRequestObject();
function createRequestObject() {
var objTemp = false;
if (window.XMLHttpRequest) {
objTemp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
objTemp = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
alert("Your browser does not support XMLHTTP!");
}
//return objTemp;
objTemp.onreadystatechange=function();
}
function getData_process() {
if (objRequest) { uurl='process_1.php?chk_pg=P&&smon='+document.getElementById("smon").value+'&&syear=' +document.getElementById("syear").value+'&&smon2=' +document.getElementById("smon2").value+'&&syear2=' +document.getElementById("syear2").value+'&&sday2=' +document.getElementById("sday2").value+'&&sday=' +document.getElementById("sday").value+'&&hmain='+document.getElementById("hmain").value;
var pmeters = 'sday='+document.getElementById("sday").value;
objRequest.open("POST", uurl);
objRequest.onreadystatechange = handleResponse;
objRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded","charset=tis-620");
objRequest.setRequestHeader("Connection", "close");
objRequest.send(pmeters);
}
}
function getData_view() {
if (objRequest) { uurl='new_viewall_ajax.php?chk_pg=V&&smon='+document.getElementById("smon").value+'&&syear=' +document.getElementById("syear").value+'&&smon2=' +document.getElementById("smon2").value+'&&syear2=' +document.getElementById("syear2").value+'&&sday2=' +document.getElementById("sday2").value+'&&sday=' +document.getElementById("sday").value+'&&hmain=' +document.getElementById("hmain").value;
var pmeters = 'sday='+document.getElementById("sday").value;
objRequest.open("POST", uurl);
objRequest.onreadystatechange = handleResponse;
objRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded","charset=tis-620");
objRequest.setRequestHeader("Connection", "close");
objRequest.send(pmeters);
}
}
function handleResponse() {
var objDiv = document.getElementById("targetDiv");
if(objRequest.readyState == 1){
objDiv.innerHTML = '<br><img src="img/loading120.gif" width="320" height="220" align="center"></br><table width="26%"><tr><td align="center" class="FontSize10"><font color="blue">กรุณารอสักครู่...</font></td></tr></table>';
}else if (objRequest.readyState == 4 ) {
objDiv.innerHTML = objRequest.responseText;
}
objRequest.send(null);
}
</script>
Tag : PHP, PostgreSQL
|
|
|
|
|
|
Date :
2015-03-25 16:09:34 |
By :
pranktip |
View :
745 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใน FireFox ก็ไม่แสดงภาพคะ
|
|
|
|
|
Date :
2015-03-25 16:10:24 |
By :
pranktip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใน script ข้างล่าง การกำหนด parameter ให้กับ url
ตัวขั้น parameter && แก้ ให้เหลือตัวเดียว ดูครับ
ส่วนข้างล่างเป็นตัวอยา่งการใช้ ajax ครับ ก็ลองศึกษาดูครับ
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>Untitled Document</title>
</head>
<body>
<script language="javascript" type="text/javascript">
///////////////////////////////////////////////////////////////////////////
/////// Below is Function to recieve result from function ale_1(idx).
///////////////////////////////////////////////////////////////////////////
var http = Array();
function new_ajax(url, param, ele, callback){
var j='x_'+http.length;
http[j]='a';
if(window.XMLHttpRequest){ //IE7, Mozilla ,Firefox
http[j] = new XMLHttpRequest();
}else if(window.ActiveXObject){ //IE6?IE5
try{ http[j] = new ActiveXObject( "Msxml2.XMLHTTP ");} catch (e){ ; }
if( http[j] == null) try { http[j] = new ActiveXObject( "Microsoft.XMLHTTP ");} catch (e){; }
}else{
alert('not found HttpRequtest'); return false;
}
try {
http[j].open("POST", url, false);
} catch (e) { alert( "2: Error http.open: \nurl="+url+"\n\n" + e + "\n\n"+ "Click OK to continue.\n\n"); return false; }
var param_len = param.length;
http[j].setRequestHeader("Method", "POST "+url+' HTTP/1.1');
http[j].setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http[j].send(param);
if(http[j].readyState == 4)
if(http[j].status == 200) {
var txt=http[j].responseText;
if(callback !== null) callback.request_ok(txt, ele);
}
http[j] = null;
return true;
}
var js_job={
request_ok: function (rs, ele){
if(ele=='test') { this.result(rs); } else
if (ele!='no_alert') alert('43||'+rs);
},
sendAjax: function(url, param){
new_ajax(url, param, 'test', js_job)
},
result:function(rs){
var data=this.explode('|', rs);
add2Table(data);
},
explode: function(delimiter, ele) {
tempArray=new Array(1);
var count=0, z, ix;
var tmp_Str=new String(ele.trim());
while ((ix=tmp_Str.indexOf(delimiter))>-1) {
z=ix==0? '' : tmp_Str.substr(0,ix).trim();
if(z.length) { tempArray[count]=z; count++;}
//tmp_Str=tmp_Str.substr( ix+delimiter.length);
tmp_Str=tmp_Str.substr( ix+delimiter.length, tmp_Str.length-(ix+delimiter.length)+1 );
}
tempArray[count]=tmp_Str;
return tempArray;
}, ///////////////////////////////////////////////////////////
test: ''
}
/////////////////////////////////////////////////////////////////////*/
function getJob(){
var param=document.getElementById('select_job').value;
if(confirm('ajax.php'+'?'+'testAjax='+param+'&newvar=xxx' ))
js_job.sendAjax('ajax.php', 'testAjax='+param+'&newvar=xxx');
}
function add2Table(rs){
var tb=document.getElementById('testTB');
var ro = tb.insertRow(tb.rows.length);
ro.insertCell(0).innerHTML=rs[0];
ro.insertCell(1).innerHTML=rs[1];
}
</script>
<table><tr>
<td>
<select id="select_job" >
<option value="getYourJob1">getYourJob1</option>
<option value="getYourJob2">getYourJob2</option>
</select></td>
<td><input type="button" value="get data" onclick="getJob()" /></td>
</tr></table>
<table border="1" id="testTB">
<tr><th>Item</th><th>Description</th></tr>
</table>
</body>
</html>
Code (PHP)
<?php
//ajax.php
define('delimeter', '|');
print_r($_REQUEST); exit;
//include('connectYourDB.php');
if(isset($_REQUEST['testAjax'])){
switch($_REQUEST['testAjax']){
case 'getYourJob1':
echo 'field1', delimeter, 'field2';
break;
case 'getYourJob2':
echo 'field3', delimeter, 'field4';
break;
}
}
?>
|
|
|
|
|
Date :
2015-03-26 10:46:32 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ค่ะ ตอนนี้ภาพ Loading แสดงแล้วค่ะ แต่ติดปัญหาตรงที่ เวลาเราเลือกวันเดือนปี ครั้งแรก จะแสดงวันเดือนปีถูก และพอเราเลือกใหม่ในหน้าจอเดิม แล้วกดดู มันแสดงวันที่ปัจจุบันค่ะ แก้ยังไงให้แสดงวันที่เราเลือกค้ะ
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<HEAD>
<TITLE>Test Send Value Ajax</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<script language="javascript" src="_functions/JavaFunction.js"></script>
<link href="fontTahoma.css" rel="stylesheet" type="text/css">
</HEAD>
<?php
$fMonth=array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
if (isset($_POST['sday'])){$sday=trim($_POST['sday']); }
else {$sday=date('d');}
if (isset($_POST['smon'])){$smon=trim($_POST['smon']); }
else {$smon=date('m');}
if (isset($_POST['syear'])){$syear=trim($_POST['syear']); }
else {$syear=date('Y')+543;}
if (isset($_POST['sday2'])){ $sday2=trim($_POST['sday2']); }
else {$sday2=date('d');}
if (isset($_POST['smon2'])){$smon2=trim($_POST['smon2']); }
else {$smon2=date('m');}
if (isset($_POST['syear2'])){ $syear2=trim($_POST['syear2']); }
else {$syear2=date('Y')+543;}
?>
<form name="view_test" method="POST" action="index.php">
<BODY>
<?php
require_once('_connections/conPG.php');
include('_function/phpFunction.php');
$hmain='10736';
$nnhos='';
$dd1="select min(registdate) as aa from maindata3 where hmain='$hmain'";
//echo $dd1."<br>";
$rs_dd1=$conPG->Execute($dd1) or die ($conPG->ErrorMSG());
while(!$rs_dd1->EOF){
$mindate =$rs_dd1->Fields('aa');
$rs_dd1->MoveNext();
}
$dd2="select max(registdate) as aa from maindata3 where hmain='$hmain'";
$rs_dd2=$conPG->Execute($dd2) or die ($conPG->ErrorMSG());
while(!$rs_dd2->EOF){
$maxdate =$rs_dd2->Fields('aa');
$rs_dd2->MoveNext();
}
$kk="select * from hospital where hmain='$hmain'";
$rs_kk=$conPG->Execute($kk) or die ($conPG->ErrorMSG());
while(!$rs_kk->EOF){
$nnhos =$rs_kk->Fields('namehos');
$rs_kk->MoveNext();
}
?>
<table border="0" >
<th class="FontSize10B"><font color="blue"><U>การประมวลผลข้อมูล</U></font>
<?php echo $nnhos."(".$hmain.")"; ?>
</th>
</table>
<table border="1">
<tr class="FontSize10">
<td>เริ่มวันที่</td>
<td>
<select name="sday" id="sday" >
<option value="00" selected>-วัน-</option>
<?php
$sVal='';
for ($i=1; $i<32; $i++)
{
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if (intval($sday)==intval($sVal)) { echo ' SELECTED'; }
echo '>'.intval($sVal).'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="smon" id="smon" >
<option value="00" selected>-เลือกเดือน-</option>
<?php
$sVal='';
for ($i=1; $i<13; $i++) {
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($smon==$sVal) { echo ' SELECTED'; }
echo '>'.$fMonth[intval($sVal)].'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="syear" id="syear" >
<option value="00" selected>-เลือกปี-</option>
<?php
$sVal='';
for ($i=0; $i<11; $i++) {
$sVal=date('Y')+(543-$i);
echo '<option value="'.$sVal.'"';
if ($syear==$sVal) { echo ' SELECTED'; }
echo '>'.$sVal.'</option>'."\n";
}
?>
</select>
</td>
<td width="50" class="FontSize10" align="center">ถึงวันที่</td>
<td>
<select name="sday2" id="sday2" >
<option value="00" selected>-วัน-</option>
<?php
$sVal='';
for ($i=1; $i<32; $i++)
{
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($sday2==$sVal) { echo ' SELECTED'; }
echo '>'.intval($sVal).'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="smon2" id="smon2" >
<option value="00" selected>-เลือกเดือน-</option>
<?php
$sVal='';
for ($i=1; $i<13; $i++) {
if ($i<10) { $sVal='0'.$i; } else { $sVal=$i; }
echo '<option value="'.$sVal.'"';
if ($smon2==$sVal) { echo ' SELECTED'; }
echo '>'.$fMonth[intval($sVal)].'</option>'."\n";
}
?>
</select>
</td>
<td>
<select name="syear2" id="syear2" >
<option value="00" selected>-เลือกปี-</option>
<?php
$sVal='';
for ($i=0; $i<11; $i++) {
$sVal=date('Y')+(543-$i);
echo '<option value="'.$sVal.'"';
if ($syear2==$sVal) { echo ' SELECTED'; }
echo '>'.$sVal.'</option>'."\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><input type="button" name="vtn" value="Ok....Test" onclick="getData_process();"></td>
<td colspan="8" align="left" class="FontSize10"><font color="blue">
ประมวลผลล่าสุด
<?php echo $nnhos; ?>
<?php echo iconv('TIS-620','UTF-8',thaidate($mindate)); ?> ถึง
<?php echo iconv('TIS-620','UTF-8',thaidate($maxdate)); ?>
</font>
</td>
</tr>
</table>
<input type="text" name="test1" id="test1" value="">
<input type="hidden" name="hmain" id="hmain" value="<?php echo $hmain; ?>">
</BODY>
</form>
<div id="targetDiv"></div>
</HTML>
<script language="javascript">
<!--
var dForm=self.document.view_test;
var objRequest = createRequestObject();
function createRequestObject() {
var objTemp = false;
if (window.XMLHttpRequest) {
objTemp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
objTemp = new ActiveXObject("Microsoft.XMLHTTP");
}
return objTemp;
}
function getData_process() {
if (objRequest) {
uurl='test.php?chk_pg=P';
var pmeters = 'sday='+document.getElementById('sday').value+"&smon=" +document.getElementById('smon').value+"&syear=" +document.getElementById('syear').value+'&sday2=' +document.getElementById('sday2').value+"&smon2=" +document.getElementById('smon2').value+"&syear2=" +document.getElementById('syear2').value+"&hmain=" +document.getElementById('hmain').value+"&test1="+document.getElementById('test1').value;
objRequest.open("POST", uurl);
objRequest.onreadystatechange = handleResponse;
objRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded","charset=tis-620");
objRequest.setRequestHeader("Connection", "close");
objRequest.send(pmeters);
}
}
function handleResponse() {
var objDiv = document.getElementById("targetDiv");
if(objRequest.readyState == 1){
objDiv.innerHTML = '<br><img src="img/loading120.gif" width="320" height="220" align="center"></br><table width="26%"><tr><td align="center" class="FontSize10"><font color="blue">กรุณารอสักครู่...</font></td></tr></table>';
}else if (objRequest.readyState == 4 ) {
objDiv.innerHTML = objRequest.responseText;
}
objRequest.send(null);
}
-->
</script>
|
|
|
|
|
Date :
2015-04-08 16:30:45 |
By :
pranktip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้เป็นไฟล์ที่แสดงค่ะ test.php
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<HEAD>
<TITLE>Test Send Value Ajax</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<script language="javascript" src="_functions/JavaFunction.js"></script>
</HEAD>
<?php
require_once('_connections/conPG.php');
include('_function/phpFunction.php');
if (isset($_GET['chk_pg'])) {$chk_pg=$_GET['chk_pg']; }else {$chk_pg='';}
if (isset($_POST['test1'])) {$test1=trim($_POST['test1']); }else {$test1='';}
if (isset($_POST['test2'])) {$test2=trim($_POST['test2']); }else {$test2='';}
if (isset($_POST['hmain'])) {$hmain=$_POST['hmain']; }else {$hmain='';}
if (isset($_POST['sday'])){$sday=trim($_POST['sday']); }
//else {$sday=date('d');}
if (isset($_POST['smon'])){$smon=trim($_POST['smon']); }
//else {$smon=date('m');}
if (isset($_POST['syear'])){$syear=trim($_POST['syear']); }
//else {$syear=date('Y')+543;}
if (isset($_POST['sday2'])){ $sday2=trim($_POST['sday2']); }
//else {$sday2=date('d');}
if (isset($_POST['smon2'])){$smon2=trim($_POST['smon2']); }
//else {$smon2=date('m');}
if (isset($_POST['syear2'])){ $syear2=trim($_POST['syear2']); }
//else {$syear2=date('Y')+543;}
$sDate1=$syear.$smon.$sday;
$eDate2=$syear2.$smon2.$sday2;
$ssum_s1=0;$ssum_s2=0;$ssum_s3=0;$ssum_s4=0;$ssum_s5=0;$ssum_all=0;
$area='76';
if($chk_pg=="P"){
//$qry="select * from maindata";
//$rs_n3=$conPG->Execute($qry) or die ($conPG->ErrorMSG());
//$req_n3=pg_query($qry);
//$num_n3=pg_num_rows($req_n3);
//echo "Num->".$num_n3."<br>";
echo "chk_PG->".$chk_pg."<br>";
echo "HMAIN->".$hmain."<br>";
echo "sday->".$sday."<br>";
echo "smon->".$smon."<br>";
echo "syear->".$syear."<br>";
echo "sday2->".$sday2."<br>";
echo "smon2->".$smon2."<br>";
echo "syear2->".$syear2."<br>";
echo "sDate1->".$sDate1."<br>";
echo "eDate2->".$eDate2."<br>";
echo "Test1->".$test1."<br>";
}
?>
|
|
|
|
|
Date :
2015-04-08 16:32:48 |
By :
pranktip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|