Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สอบถามรายงาน Error ใส่ java-script การกรองข้อมูลไปแล้ว ค้นหา คลิกหน้าถัดไปไม่ไปแก้ไขอย่างไรครับ



 

สอบถามรายงาน Error ใส่ java-script การกรองข้อมูลไปแล้ว ค้นหา คลิกหน้าถัดไปไม่ไปแก้ไขอย่างไรครับ

 



Topic : 076968



โพสกระทู้ ( 15 )
บทความ ( 0 )



สถานะออฟไลน์




รบกวนดูโดให้หน่อยครับ ผมทำค้นหาข้อมูลโดยมีการเลือกข้อมูล -ภูมิภาค ตามด้วย -จังหวัด แล้วคลิกปุ่มค้นหา พอข้อมูลออกมาแล้วข้อมูลใน List Box ที่เป็น -ภูมิภาค ตามด้วย -จังหวัด หายไป ทำให้เวลาที่เราจะคลิกเลือกรายงานหน้าถัดไป ข้อมูลไม่ขึ้นครับ จะต้องทำการค้นหาใหม่อีกรอบ ต้องแก้ไขอย่างไรครับ รบกวนดูโค้ดให้หน่อยครับ
ต้องทำอย่างไรเวลาที่คลิกปุ่มค้นหาแล้วข้อมูลที่เราเลือกไว้จะไม่หายไปครับ

Code (PHP)
<?
			// แบ่ง page
	   $page=$_GET["page"];
		if(count($_GET)==0 || !isset($_GET["page"]) ){ $page=1; }
		$Per_Page=20;   //ขนาดต่อหน้า
		if ($page>0){
			$Page_start=(($page-1)*$Per_Page);
		}else{
			$Page_start=($page)*$Per_Page-1;
		}		
		$page_stop=$Page_start+$Per_Page;
		if(count($arr_rec)==0)$page_stop=0;
	if($page_stop>count($arr_rec))$page_stop=count($arr_rec);	
		?>
<body>
<table width="1150" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CC33FF">
  <tr>
    <td width="996"><img src="images/Banner.gif" width="1210" height="226" /></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><?php include("menu1.php"); ?></td>
  </tr>
  <tr bgcolor="#eaf8ff">
    <td height="40" bgcolor="#eaf8ff">&nbsp;</td>
  </tr>
  
  <tr bgcolor="#eaf8ff">
    <td height="128" bgcolor="#eaf8ff"><form name="frSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>" enctype="multipart/form-data"> 
      <table width="557"0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
          <td height="43" colspan="2" bgcolor="#95c6e3"><div align="center"><span class="style6">รายงานผู้อยู่ระหว่างเพิกถอนสิทธิการเลือกตั้ง<strong><br />
                  <span class="style17">[--จำแนกตามภูมิภาค (ตามประกาศนายทะเบียนพรรคการเมือง--] </span></strong></span></div></td>
        </tr>
        <tr>
          <td width="154" height="30"" bgcolor="#eaf8ff"44><div align="right" class="style5">ภาค : </div></td>
          <td width="394" bgcolor="#eaf8ff"><span class="style12">
            <select name="slact_id" id="slact_id" onchange="return(clicklist(this));">
              <option value="">- ภูมิภาค -</option>
              <?
include "config.inc.php";
$sql="select * from TypeProvince order by TypeProvince_Id ASC";
$dbquery=mysql_db_query($dbname,$sql);$str_combo_arr .="a[0] = new Array(\"\", \"  - การกระทำผิด -  \");\n";
$i=1;
while($result=mysql_fetch_array($dbquery)){
	$str_combo_arr .="a[$i] = new Array(";
	$str_combo_arr .="\"\",\"  - จังหวัด -  \"";

	$sql="select * from Province where TypeProvince_Id='$result[TypeProvince_Id]' order by Province_Id ";
	$dbquery2=mysql_db_query($dbname,$sql);
	while($result2=mysql_fetch_array($dbquery2)){
		$str_combo_arr .=",";
		$str_combo_arr .="\"$result2[Province_Id]\",\"$result2[Province_Name]\"";
		if($data['Province_Id'] !="" ){
			 $select_off="";
			if("$data[Province_Id]" == "$result2[Province_Id]") //เพื่อให้ แสดง $cat_id ที่ส่งค่ามาให้
			 	  $select_off=" selected=\"selected\"";
    	    if($result2[TypeProvince_Id]==$data[TypeProvince_Id])
			$str_combo .="<option value=\"$result2[Province_Id]\"$select_off  $data[Province_Id]>$result2[Province_Name]</option>\n";
		}		  			
	}
$str_combo_arr .=");\n";
		if($data['TypeProvince_Id'] == $result[TypeProvince_Id]){ //เพื่อให้ แสดง $cat_id ที่ส่งค่ามาให้
?>
              <option value="<?=$result[TypeProvince_Id];?>" selected="selected">
              <?=$result[TypeProvince_Name];?>
              </option>
              <?
		}else{?>
              <option value="<?=$result[TypeProvince_Id];?>">
              <?=$result[TypeProvince_Name];?>
              </option>
              <?
		} 
	$i++;
	}
?>
            </select>
          </span><span class="style12">
          <input name="select_portionid_tmp" type="text" id="select_portionid_tmp" />
          </span>
          
        <tr>
          <td width="154" height="30" bgcolor="#eaf8ff"><div align="right" class="style5">จังหวัดที่เป็นภูมิภาค  : </div></td>
          <td width="394" bgcolor="#eaf8ff"><span class="style12">
            <select name="sloffence_id" id="sloffence_id"   onchange="return(clicklist2(this));">
              <option value="" selected="selected">- จังหวัด -</option>
              <?=$str_combo;?>
            </select>
          </span><span class="style12">
            <input name="select_provinceid_tmp" type="text" id="select_provinceid_tmp" />
            </span>            <span class="style5 style14">
            <input name="page" type="hidden" id="page" value="<?=$page?>" />
          </span></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#CCCCCC"><label></label>
            <div align="center">
              <input type="submit" name="Submit" value="ค้นหา" />
            </div></td>
        </tr>
      </table>
    </form>    </td>
  </tr>
  <tr bgcolor="#eaf8ff">
    <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#eaf8ff">
    <td><? 
 $_GET["txtKeyword"]  = $select_portionid_tmp;
  $_GET["txtKeyword2"] = $select_provinceid_tmp;
  
if($_GET["slact_id"] != "") 
{ 
	include("config.inc.php");
//$objConnect = mysql_connect("127.0.0.1","root","431320436") or die("Error Connect to Database"); 
//$objDB = mysql_select_db("judgement"); 
//$_SESSION['province'] =$_GET["slact_id"] ;
   $strSQL = "SELECT disfranchisedvoter1.`ID`, disfranchisedvoter1.`DFV_DateInput`, disfranchisedvoter1.`tumbon_id`, disfranchisedvoter1.`DFV_FName`, disfranchisedvoter1.`DFV_LName`, disfranchisedvoter1.`DFV_Domicile`, disfranchisedvoter1.`DFV_Ban1`, disfranchisedvoter1.`DFV_Ban2`, disfranchisedvoter1.`DFV_Ban3`, disfranchisedvoter1.`DFV_Road`, disfranchisedvoter1.`DFV_DateS`, Typejudgement1.`TJ_Name`, disfranchisedvoter1.`DFV_DateE`, disfranchisedvoter1.`SDV_Id`, disfranchisedvoter1.`Province_Id`, typeprovince1.`TypeProvince_Name`,  typeprovince1.`TypeProvince_Id`, province1.`Province_Name`, offence1.`Offence_Details`,title1.`Title_Name`,disfranchisedvoter1.`DFV_Domicile`,year1.`YearName`,Amphur1.`amphur_name`,Provinceoff1.`Provinceoff_Name`  FROM (((((((`judgement`.`disfranchisedvoter` disfranchisedvoter1 INNER JOIN `judgement`.`offence` offence1 ON disfranchisedvoter1.`Offence_Id` = offence1.`Offence_Id`) INNER JOIN `judgement`.`title` title1 ON disfranchisedvoter1.`Title_Id` = title1.`Title_Id`) INNER JOIN `judgement`.`province` province1 ON disfranchisedvoter1.`Province_Id` = province1.`Province_Id`) INNER JOIN `judgement`.`year` year1 ON disfranchisedvoter1.`YearId` = year1.`YearId` ) INNER JOIN `judgement`.`typeprovince` typeprovince1 ON province1.`TypeProvince_Id` = typeprovince1.`TypeProvince_Id`) INNER JOIN `judgement`.`Typejudgement` Typejudgement1 ON disfranchisedvoter1.`TJ_Id` = Typejudgement1.`TJ_Id`) INNER JOIN `judgement`.`Amphur` Amphur1 ON disfranchisedvoter1.`amphur_Id` = Amphur1.`amphur_Id`) INNER JOIN `judgement`.`Provinceoff` Provinceoff1 ON disfranchisedvoter1.`Provinceoff_Id` = Provinceoff1.`Provinceoff_Id`  WHERE (province1.`TypeProvince_Id`  = '".$_GET["txtKeyword"]."' And disfranchisedvoter1.`SDV_Id` = 001 and  province1.`Province_Id` = '".$_GET["txtKeyword2"]."')  order by TypeProvince_Id ASC,Province_Name ASC,DFV_FName ASC"; 
 // echo $strSQL;
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); 
$totalRows=mysql_num_rows($objQuery);
$totalRowsT=mysql_num_rows($objQuery);
if($Page_start>$totalRows)$Page_start=0;
$objQuery = mysql_query($strSQL ." LIMIT  $Page_start , $Per_Page ") or die ("Error Query [".$strSQL."]"); 

			$sql = $strSQL ." LIMIT  $Page_start , $Per_Page ";
			$rec = mysql_query($sql)or die ("Error Query [".$sql."]"); 
			while($obj1 = mysql_fetch_array($rec)){				
				$total[$obj1["Province_Name"]]=$total[$obj1["Province_Name"]]+1;
				$total1[$obj1["TypeProvince_Name"]]=$total1[$obj1["TypeProvince_Name"]]+1;				
			}
?><table width="1200" border="0">
  <tr>
<td width="1200" align="right"><span class="style5 ">จำนวนข้อมูลทั้งหมด :  <?echo $totalRows?> Recode  </span> <a href="psearchzone.php"><img src="images/p.gif" width="16" height="17" border="0" /></a></td>
  </tr>
  <tr>
    <td align="right"><div align="center">รายงานผู้ถูกเพิกถอนสิทธิเลือกตั้ง</div></td>
  </tr>
  <tr>
    <td height="18" align="right"><div align="center">จำแนกตามภูมิภาค <br>(ตามประกาศนายทะเบียนพรรคการเมือง)</div> </td>
       <table width="1200" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CC33FF">
        <tr> 
         <td width="90" bgcolor="#CCCCCC" class="style5"><div align="center">ภูมิภาค</div> </td>
          <td width="80" bgcolor="#CCCCCC" class="style5"><div align="center">จังหวัด</div></td>
		  <td width="40" bgcolor="#CCCCCC" class="style5"><div align="center">ลำดับที่</div></td>
		  <td width="165" bgcolor="#CCCCCC" class="style5"><div align="center">ชื่อ - สกุล </div></td>
          <td width="120" bgcolor="#CCCCCC" class="style5"><div align="center">เลขประจำตัวประชาชน</div></td>          
          <td width="230" bgcolor="#CCCCCC" class="style5"><div align="center">ภูมิลำเนาปัจจุบัน</div></td>
          <td width="80" bgcolor="#CCCCCC" class="style5"><div align="center">จังหวัดที่กระทำความผิด</div></td>
          <td width="77" bgcolor="#CCCCCC" class="style5"><div align="center">วันแรกที่ถูกเพิกถอนสิทธิ</div></td>
          <td width="60" bgcolor="#CCCCCC" class="style5"><div align="center">ระยะเวลาที่ถูกเพิกถอน (ปี)</div></td>
          <td width="77" align="center" bgcolor="#CCCCCC" class="style5">วันแรกที่พ้นการถูกเพิกถอนสิทธิ</td>
          <td width="230" bgcolor="#CCCCCC" class="style5"><div align="center">ลักษณะความผิด</div></td>
        </tr>        
        <? $totalRows=0; $a=0; $totalRows0=0;
$Page_start+1;
while($objResult = mysql_fetch_array($objQuery)) 
{
?>
   <tr>
   		 <? 
			if($totalRows0==0){
				$totalRows0=$total1[$objResult["TypeProvince_Name"]];
				echo "<td bgcolor=\"#eaf8ff\" class=\"style5\" align=\"center\"  rowspan=\"".$totalRows0."\"><div align=\"center\" class=\"style5\" >".$objResult["TypeProvince_Name"] ."</div></td>";
			}else{	
				//echo "<td bgcolor=\"#eaf8ff\" class=\"style5\" align=\"center\" rowspan=\"".$totalRows0."\">$totalRows0</div></td>";
			}
			if($totalRows==0){
				$totalRows=$total[$objResult["TypeProvince_Name"]];      
				echo '     
          <td bgcolor="#eaf8ff" class="style5" rowspan="'.$totalRows.'" valign="top"><div align="center" class="style5" >';
				echo $objResult["Province_Name"];
				echo '</div></td>';
			}
			?>
		<td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5"> 
		<?=$k+1+($Page_start );?></div></td>    
		 <td bgcolor="#eaf8ff" class="style5"><div align="left" class="style5"><?=$objResult["Title_Name"];?><?=$objResult["DFV_FName"];?>   <?=$objResult["DFV_LName"];?></div></td>


        <td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5">
		<?=substr($objResult["ID"],0,1);?>-<?=substr($objResult["ID"],1,4);?>-<?=substr($objResult["ID"],5,5);?>-<?=substr($objResult["ID"],10,2);?>-<?=substr($objResult["ID"],12,1);?></div></td>

          <td bgcolor="#eaf8ff" class="style5"><div align="left" class="style5">
				  <? $tam = $objResult["tumbon_id"]; ?>
				  <input name="slact_id3" type="hidden" id="slact_id3">
				  <? $_GET["slact_id3"] = $tam; ?>
				 <? $sql="SELECT tumbon_name FROM Tumbon WHERE tumbon_id = '".$_GET["slact_id3"]."' ";
				 $res=mysql_query($sql);
				 $data=mysql_fetch_assoc($res);
				 $datanew = $data['tumbon_name']; ?>
		  <?=$objResult["DFV_Domicile"];?> หมู่ที่ <?=$objResult["DFV_Ban1"];?>  <?=$objResult["DFV_Ban2"];?>  <?=$objResult["DFV_Ban3"];?>  <?=$objResult["DFV_Road"];?>  <?=$objResult["DFV_Road"];?> ต.<?echo $datanew;?>อ.<?=$objResult["amphur_name"];?> จ.<?=$objResult["Province_Name"];?> </td></div></td>
<td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5"> 
		   <?=$objResult["Provinceoff_Name"];?></div></td>    		  
<?	$DFV_DateS=explode("-",$objResult['DFV_DateS']);$objResult['DFV_DateS']=$DFV_DateS[2]. "-". $DFV_DateS[1]."-".($DFV_DateS[0]+543);?>
          <td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5"><?=$objResult["DFV_DateS"];?></div></td>
   <td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5"><?=$objResult["YearName"];?></div></td>
		  <?	$DFV_DateE=explode("-",$objResult['DFV_DateE']);$objResult['DFV_DateE']=$DFV_DateE[2]. "-". $DFV_DateE[1]."-".($DFV_DateE[0]+543);?>
 <td bgcolor="#eaf8ff" class="style5"><div align="center" class="style5">
 <?=$objResult["DFV_DateE"];?></div></td>
			<td bgcolor="#eaf8ff" class="style5"><div align="left" class="style5"> 
			<?=$objResult["Offence_Details"];?></div></td>          
        </tr>		
		
        <? $totalRows--; $a++; $totalRows0--; 
	$n++;$k++;
} 
?>
      </table>
      </td>
  </tr>
   <tr bgcolor="#eaf8ff">
     <td>&nbsp;</td>
   <tr bgcolor="#eaf8ff">
     <td><div align="center"><span class="style5"><span class="style16">หน้าที่
      &gt;&gt;</span>
           <?	 $p=floor($totalRowsT/$Per_Page)   ;
	if(count($_GET)==0 || !isset($_GET["page"]) ){ $p=1; }
	 if($totalRowsT%$Per_Page>0) $p++;  	
	 while($p>0){
	 	if($ps!="")$ps="&nbsp;|&nbsp;".$ps;
		if($page==$p){
	 		$ps="<strong>$p</strong>".$ps;
		}else{
			$ps="<a href=\"#\"  onclick=\"page('$p');\">$p</a>".$ps;
		}
	 	$p--;
	 } echo $ps;?>
     </span></div></td>
   <tr bgcolor="#eaf8ff">
     <td><div align="center"><span class="style5">
       <? 
//mysql_close($objConnect); 
} 
?>
     </span></div></td>
   <tr>
     <td bgcolor="#eaf8ff"><div align="center" class="style5">| <a href="menu.php">กลับเมนูหลัก</a> |</div></td>
   <tr>
     <td bgcolor="#eaf8ff">&nbsp;</td>
   <tr>
     <td bgcolor="#d5efff"><div align="center">
       <?PHP  include("foot.php"); ?>
     </div></td>
</table>
</body>
</html>

<script language="javascript">
<!--
var a = new Array();
<?=$str_combo_arr?>


function clearcombo(elem){
	 var i;
	 for (i = elem.options.length - 1; i >= 0; i--) elem.options[i] = null;
	 elem.selectedIndex = -1;
}
function populatesubcategoryID(elem, index){
	 for (var i = 0; i < a[index].length; i= i + 2){
	  	elem.options[elem.options.length] = new Option(a[index][i + 1], a[index][i]);
	 }
}
function clicklist(elem){
	 clearcombo(document.frSearch.sloffence_id)
	 populatesubcategoryID(document.frSearch.sloffence_id, parseInt(elem[elem.selectedIndex].value));
	 document.frSearch.select_portionid_tmp.value=elem[elem.selectedIndex].value;
	 return true;
}
function clicklist2(elem){

	 document.frSearch.select_provinceid_tmp.value=elem[elem.selectedIndex].value;
	 return true;
}
-->
</script>


ตัวอย่างหน้ารายงาน



Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-04-11 23:51:09 By : ninja436 View : 1149 Reply : 1
 

 

No. 1



โพสกระทู้ ( 87 )
บทความ ( 0 )



สถานะออฟไลน์


ลองดูที่บรรทัดนี้ดูนะครับ if($data['TypeProvince_Id'] == $result[TypeProvince_Id])

มันน่าจะเป็นการตรวจสอบจากค่า GET หรือเปล่าครับ ?? อย่าลืมนะครับว่ามันเป็น Form

ไม่ใช่ตัวแปร Local






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-14 00:51:51 By : smeproject
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามรายงาน Error ใส่ java-script การกรองข้อมูลไปแล้ว ค้นหา คลิกหน้าถัดไปไม่ไปแก้ไขอย่างไรครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่