|  | 
	                
  
    | 
	 
        สอบถามการส่งค่าผ่าน form ครับ  form ไม่ครอบคลุม ฟิลด์ทั้งหมดครับ  ทำให้ค่าที่ส่งไป ไม่มีค่าครับ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | จากโค้ดครับ  ใช้วิธีการ Search แบบ Ajax  ซึ่งผมก็ได้ให้  tag form ครอบคลุม พื้นที่แล้ว  แต่มันคลุมแค่ ปุ่ม submit อ่ะครับ  ผมเปิดใน Firebug ดู ค่า ใน RadioGroup มันไม่ส่งไปใน form อ่ะครับ  เมื่อเราเลือก RadioGroup แล้ว
 
 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>ระบบฐานข้อมูลค้นหารายวิชาเทียบโอน</title>
</head>
<script language="javascript">
var HttPRequest = false;
function doCallAjax1(Year1,Search1) {
  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 = 'ajaxsearch1.php';
	var pmeters = 'mySearch1='+Search1+'&selYear1='+Year1;
	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("search1").innerHTML = "<div align='center' style='color:green;'>Now is Loading...</div>";
		  }
		 if(HttPRequest.readyState == 4) // Return Request
		  {
		   document.getElementById("search1").innerHTML = HttPRequest.responseText;
		   //setTimeout("clearTextBox();",400);
		  }
	}
}
function doCallAjax2(Year2,Search2) {
  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 = 'ajaxsearch2.php';
	var pmeters = 'mySearch2='+Search2+"&selYear2="+Year2;
	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("search2").innerHTML = "<div align='center' style='color:blue;'>Now is Loading...</div>";
		  }
		 if(HttPRequest.readyState == 4) // Return Request
		  {
		   document.getElementById("search2").innerHTML = HttPRequest.responseText;
		   //setTimeout("clearTextBox();",400);
		  }
	}
}
</script>
<body>
<div id="head">
<br>
<h1 style="margin-top:0px;" align="center">ระบบฐานข้อมูลค้นหารายวิชาเทียบโอน</h1>
<form action="print_comp.php" method="post" enctype="multipart/form-data" name="form1" target="_blank" id="form1">
  <p align="center">
  <script language="javascript">
  document.onkeydown = chkEvent 
  function chkEvent(e) {
      var keycode;
      if (window.event) keycode = window.event.keyCode; //*** for IE ***//
      else if (e) keycode = e.which; //*** for Firefox ***//
      if(keycode==13)
      {
          return false;
      }
  }
  </script>
  <input name="btn_compare" id="btn_compare" type="submit" value=""  />
  </p>
  </div>
  <div class="firstcol">
	<?php
    include("../apr/db_conn.inc.php");
    $sel1 = "select distinct(CourseYear) from dbo_subject where CourseYear = '43' or CourseYear = '49' or CourseYear = '54' order by CourseYear desc;";
    $qry1 = mysql_query($sel1)or die(mysql_error());
    ?>
    <p align="center">
    <div class="labelInput">
    <label for="selYear1">หลักสูตรปี : </label>
      <select name="selYear1" id="selYear1">
    <option value="">---โปรดระบุปีหลักสูตร---</option>
    <?php
    while($rst1 = mysql_fetch_assoc($qry1))
    {
    ?>
        <option value="<?=$rst1["CourseYear"];?>"><?=2500+$rst1["CourseYear"];?></option>
    <?php
    }
    ?>
    </select>
  </div>
  </p>
  <p align="center">
    <div class="labelInput">
      <label for="txtSearch1">ค้นหารหัสวิชา/ชื่อวิชา : </label>
      <input type="text" name="txtSearch1" id="txtSearch1" />
      <input type="button" name="btn_search1" id="btn_search1" value="ค้นหา" onclick="javascript:doCallAjax1(document.getElementById('selYear1').value,document.getElementById('txtSearch1').value);" />
    </div>
  </p>
    <span id="search1"></span>
  </div>
  
  <div class="secondcol">
	<?php
    include("../apr/db_conn.inc.php");
    $sel2 = "select distinct(CourseYear) from dbo_subject where CourseYear = '43' or CourseYear = '49' or CourseYear = '54' order by CourseYear desc;";
    $qry2 = mysql_query($sel2)or die(mysql_error());
    ?>
    <p align="center">
    <div class="labelInput">
    <label for="selYear2">หลักสูตรปี : </label>
    <select name="selYear2" id="selYear2">
      <option value="">---โปรดระบุปีหลักสูตร---</option>
    <?php
    while($rst2 = mysql_fetch_assoc($qry2))
    {
    ?>
        <option value="<?=$rst2["CourseYear"];?>"><?=2500+$rst2["CourseYear"];?></option>
    <?php
    }
    ?>
    </select>
  </div>
  </p>
  <p align="center">
    <div class="labelInput">
      <label for="txtSearch2">ค้นหารหัสวิชา/ชื่อวิชา : </label>
      <input type="text" name="txtSearch2" id="txtSearch2" />
      <input type="button" name="btn_search2" id="btn_search2" value="ค้นหา" onclick="javascript:doCallAjax2(document.getElementById('selYear2').value,document.getElementById('txtSearch2').value);" />
    </div>
  </p>
    <span id="search2"></span>
  </div>
</form>
</body>
</html>
 
 
 Tag : PHP, MySQL, HTML/CSS, JavaScript
 
 
 |  
            | 
 ประวัติการแก้ไข
 2014-04-01 12:52:48
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2014-04-01 12:31:14 | By :
                          angelkiller9 | View :
                          1098 | Reply :
                          3 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ได้ละครับ  ผมไปเขียน css ในส่วนของ id = head   ฟิกความสูงไว้  form มันเรยไม่คลุม  เอา tag div id=head ออก ก็ใช้ได้แล้วครับ  งม ตั้งนาน 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2014-04-01 12:54:58 | By :
                            angelkiller9 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 |  |