  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ช่วยหน่อยครับ ผมทำเว็บประเมินด้วย checkbox php mysql อะครับแต่ทำให้มันบันทึกลงฐานข้อมูลไม่ได้  
 
Code (PHP) 
<?
include "o_connect.php";
?>
<?
$in = "$_GET[in]";
?>
<!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>
<p> </p>
<p> </p>
<form id="form1" name="form1" method="post" action="untitled1_save.php?Y=<? echo $_GET[Y];?>&maId=<?=$_GET[maId]?>&schoolId=<?=$_GET[schoolId]?>&in=<?=$_GET[in]?>">
  <table width="1091" height="52" border="1">
  
    <tr>
    <?php $q_n="SELECT indicator$_GET[Y].* FROM indicator$_GET[Y] WHERE inId = $in  ORDER BY indicator$_GET[Y].inIndex ASC";
   
		$qr_n=mysql_db_query($dbname,$q_n); 
		$row_n=mysql_fetch_assoc($qr_n);  
		$total_n=mysql_num_rows($qr_n);
		
		
		
		if($total_n!=0){
		do{
			
			
	?>
      <td width="709"><?php echo "ตัวบ่งชี้ $row_n[inIndex] $row_n[inName]";?> </td>
      
    </tr>
    <tr>
    
    
    
      <?php $q_m="SELECT mark$_GET[Y].* FROM mark$_GET[Y] WHERE inId = $row_n[inId]  ORDER BY mark$_GET[Y].maIndex ASC ";
		
		
		$qr_m=mysql_db_query($dbname,$q_m); 
		$row_m=mysql_fetch_assoc($qr_m);  
		$total_m=mysql_num_rows($qr_m);
		//echo"$query_ma<br>";
		
		
		if($total_m!=0){
		do{
	?>
      <td>
	  
	  
	  <?php echo " ตัวชี้วัดที่  $row_n[inIndex].$row_m[maIndex]. $row_m[maName]";?> </td>
      <td width="30" align="center"><input type="checkbox" name="checkbox[]" id="checkbox[]" value="1" /></td>
      <td width="162">
        <?php $query_mafile="
		SELECT *
		FROM file$_GET[Y]
		where maId= $_GET[maId] and schoolId= $_GET[schoolId]";
		//echo"$query_mafile<br>";
		$mafile=mysql_query($query_mafile) or die(mysql_error());
		$row_mafile=mysql_fetch_assoc($mafile);
		$totalRows_mafile=mysql_num_rows($mafile); 
		
		if($totalRows_mafile!=0){
			$ifile="onebit_42.png";
			}else{$ifile="onebit_41.png";}
			
		?>
   
        <div align="center"> <a href="#" onclick="popup('up.php?Y=<? echo $_GET[Y];?>&maId=<?php echo $row_m[maId]?>&schoolId=<?php echo $_GET[schoolId] ?>&in=<? echo $_GET[in];?>',800,600);" title="แนบไฟล์เอกสาร..."><img src="images/<?php echo $ifile;?>" width="20" height="20" />แนบไฟล์</a></div>
        
     </td>
    </tr>
    <?php 
  }while($row_m=mysql_fetch_assoc($qr_m));
 
  }	
	}while($row_n=mysql_fetch_assoc($qr_n));
 
  }		
  
  ?>
    
    
  </table>
  <input type="submit" name="submit" value="submit" align="center">
</form>
<p> </p>
</body>
</html>
 
 
 
หน้านี้บันทึกลงฐานข้อมูล 
Code (PHP) 
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
include"o_connect.php";
$inId = $_GET[in];
$schoolId = $_GET[schoolId];
$maId = $_GET[maId];
	
	for($i=0;$i<count($_POST['checkbox']);$i++){
		if($_POST['checkbox'][$i] != ""){
	
$sql= "INSERT INTO check$_GET[Y](chId,inId,maId,schoolId,ch1,ch2) values ('','$inId','$maId','$schoolId','".$_POST['checkbox'][$i]."')";
			$result= mysql_db_query($dbname, $sql) or die(mysql_error());
			}
	}
	if($result){
	echo "บันทึกเรียบร้อย";
	}else{
		echo "บันทึกไม่ได้";
	}
	
	
?>
</body>
 
 
  Tag : PHP, MySQL, Windows               
                        | 
           
          
            
		
  ประวัติการแก้ไข 2014-06-07 16:30:38	
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2014-06-07 16:24:19 | 
                      By :
                          vicious3 | 
                      View :
                          812 | 
                      Reply :
                          1 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |