  | 
              
	              
	                
  
    
	 
        คลิกปุ่ม submit ใน form แล้ว ส่งค่าตัวแปรไปอีกกับ form ทำอย่างไร และรับค่าตัวแปรยังไง     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Link 
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-09-01 10:02:08 | 
                        By :
                            onizike | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ส่งได้ 2 แบบคือ $_GET['ตัวแปร'] และ $_POST['ตัวแปร'] sheet 
 
test.php 
<form action="index.php?numberID=999" method="POST">
<input type="text" name="serName" />
<input type="submit" value="ตกลง" />
</form>
  
 
เวลาเรียกใช้ 
 
index.php 
echo $_GET["numberID"]."<br>"; //ผลลัพธ์จะเท่ากับ 999
echo $_POST["serName"]; //ผลลัพธ์จะได้ตามข้อมูลที่กรอกในช่อง text
  
 
$_GET['value'] จะส่งค่าผ่าน url นะครับ  
$_POST['value'] จะซ่อนการส่งข้อมูล  
 
ผิดถูกเพิ่มเติมด้วยนะครับ (มือใหม่)                          
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-09-01 10:04:24 | 
                        By :
                            fogza | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ไม่ไช่แบบนั้นครับ คือ ในไฟล์แรกผมีตัว แปล $x 
แล้วให้มันส่งค่าไปเลยทันทีที่กดsubmit โดยไม่ต้องinput ค่าไปในform แล้วค่านั้นห้ามshowในformด้วย 
กดปุ่มส่งค่าไปเลย  
เห็นแค่ปุ่มsubmitอย่างเดียว                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-09-01 10:24:40 | 
                        By :
                            sambrazil | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ส่งผ่าน hidden ไปครับ 
 
<input type="hidden" name="hdnName" value="<?=$x;?>">                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-09-01 10:43:03 | 
                        By :
                            webmaster | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 คำถามไม่เคลียร์ แสดงตัวอย่างข้อมูล และ การแทนที่ หรือ ตำแหน่ง $xxx ใน data ด้วย 
แต่เขียน topic ใหม่ดีกว่าไหม                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-17 06:59:21 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมไม่เคยใช้ readdir ใช้แต่ glob ไม่ใช่ว่า readdir ไม่ดี เพียงแต่ผมขี้เกียจไปอ่าน information ของมันอีกน่ะ 
 
Code (PHP) 
<?php
// กำหนดตัวแปร ที่จะเป็นต้องใช้
$SE = DIRECTORY_SEPARATOR;
$server_path = __DIR__ . $SE . 'DATA' . $SE;  // path สำหรับ server
$browser_path = '/DATA/';  // path สำหรับ client เรียกผ่าน browser
$dir = glob($server_path . '*.{LEE,LHA,PCM}');
// HTML / Javascript ------------------------------
?><!doctype html>
<html lang="en_US">
<head>
<title>TEST Link URL</title>
</head>
<body>
<p><h1>List of available files:</h1></p><hr><br />
<form method="post" action="maptest4.php" name="type" >
	<select  name="type"  required >
<?php //-------------------------- loop create option for select
foreach($dir as $file){
	$parts = explode($SE , $file);
	$fn = end($parts);
?>
	<option value="<?=$browser_path?>/<?=$fn?>" ><?=$browser_path?>/<?=$fn?></option>
<?php 
}
?>
	</select>
	<button type="submit" >Summit</button>
</form>
</html>
 
 
ปล. พยายามเขียน แบ่งโซน ภาษา ให้ได้มากที่สุด ถ้าจำเป็นก็ต้องผสมกัน โค๊ดจะอ่านง่าย เข้าใจง่าย                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-18 08:00:19 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 8 เขียนโดย : Chaidhanan เมื่อวันที่ 2020-09-18 08:00:19 
รายละเอียดของการตอบ ::
  -ขอบคุณมากครับ 
ตอนนี้สามารถ นำ $_post แสดงข้อมูลในไฟล์ได้แล้ว
 
ตอนนี้ อยากเอาข้อมูลที่แสดงจาก $_POST มา พอร์ตกราฟอะครับ
 Code (PHP)
<!DOCTYPE HTML>
<html>
 <head>
 
  <meta charset="utf-8">
  <meta http-equiv="Content-Type" content="text/html;">
  <meta http-equiv="X-Ua-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, maximum-scale=3, minimum-scale=0.5" />
  <Link rel="stylesheet" href="">
</head>
  <title>LoadCell</title>
  <?php
 $MT="DATA/";
 $tep ="";
 $i   =-8;
 
if ($handle = opendir("$MT")) {//????????????
    while (false !== ($entry = readdir($handle))) {
      $parts = explode(".", $entry);                   
      if (is_array($parts) && count($parts) > 0) {   
          $extension = end($parts);        
          if ($extension == "LEE" OR $extension == "LHA"OR $extension == "PCM")    
              //echo "$i.<a href=\"$MT/$entry\" target=\"_blank\"> $entry </a><br />";  
                $tep=$tep."<option value=\"$MT/$entry\">$entry</option>";  //???????????? 
              
          }
          $i++;
        }
    
    closedir($handle);
   }
   ?>
<body>
<form method="get" action=""  >
      <select  name="type"   required>
      <option>-DATA-</option>
      <option value = <?php echo ($tep);?>></option>
      </select>
   
      <button mxlns ="" type="submit" >Summit</button>
</form>
  
<?php
 $data = ""; //???????????txt ##อยากนำค่าจาก $_POST มาพอร์ตกราฟจากตัวแปรนี้ครับ
for($i=0; $i<26; $i++){ ${'num'.$i}=array();} //???????????? array
          $datafile=readfile($_GET["type"]);//?????????????? ตอนนี่ค่าที่แสดงออกมาจากตรงนี้ครับ
       
      $i = 0;
      
 foreach ($datafile as $colam){//??????????????
    
 list($num1[$i],$num2[$i],$num3[$i],$num4[$i],$num5[$i],$num6[$i],$num7[$i],$num8[$i],$num9[$i],$num10[$i],$num11[$i],$num12[$i],$num13[$i],$num14[$i],$num15[$i],$num16[$i],$num17[$i],$num18[$i],$num19[$i],$num20[$i],$num21[$i],$num22[$i],$num23[$i],$num24[$i],$num25[$i]) = explode(',', substr($line,0));  //??????????? array 
        $num1[$i] = intval(substr($num1[$i],0,-2));
        $num18[$i] = intval($num18[$i]); //???? colum 
        $num19[$i] = intval($num19[$i]);
        $num20[$i] = intval($num20[$i]);
        $num21[$i] = intval($num21[$i]);
        $num22[$i] = intval($num22[$i]);
        $target1[$i] = 10;
        $target2[$i] = 20;
        $target3[$i] = 30;
    $i++;
 
 closefile($datafile);
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>     
<script>
 $(function () {
        $('#container').highcharts({
            chart: {
                type: 'line' //????????? ??????? ??????????????? line ????????   
            },
            title: {
                text: 'Lode cell monitor' //????????
            },
            xAxis: {
                categories: ['<?= implode("','", $num1); ?>'] //????????? x  
            },
            yAxis: {
                title: {
                    text: 'Load cell value'
            },
 
            },
            tooltip: {
                enabled: false,
                formatter: function() {
                    return '<b>'+ this.series.name +'</b><br/>'+
                        this.x +': '+ this.y ;
    }
  },
   legend: {
          layout: 'vertical',
          align: 'right',
          verticalAlign: 'top',
          x: -0,
          y: 90,
         borderWidth: 0
  },
    plotOptions: {
          line: {
            dataLabels: {
              //enabled: true //????????????????????    
        },
                    enableMouseTracking: false
     }   
   },
            series: [{
                name: 'loadcell-1',
                color: '#0066FF',
                data: [<?= implode(',', $num19)?>]
            }, {
                name: 'loadcell-2',
                color: '#FF6600',
                data: [<?= implode(',', $num20)?>]
            }, {
                name: 'loadcell-3',
                color: '#33CC00',
                data: [<?= implode(',', $num21)?>]
            }, {
                name: 'loadcell-4',
                color: '#990033',
                data: [<?= implode(',', $num22)?>]
              }, {
                name: 'target : 10',
                color: '#FF0033',
                dashStyle: 'ShortDash',
                data: [<?= implode(',', $target1)?>]
              }, {
                name: 'target : 20',
                color: '#FF0033',
                dashStyle: 'ShortDash',
                data: [<?= implode(',', $target2)?>]
              }, {
                name: 'target : 30',
                color: '#FF0033',
                dashStyle: 'ShortDash',
                data: [<?= implode(',', $target3)?>]
                
            }] // ?????? array ??? y
      });
    });
        </script>
    </head> 
<body> 
      
      <body bgcolor="#cccccc">
      <div id="container" style="min-width: 480px; height: 520px; margin: 0 auto;"></div>       
    </body>
    <FORM method=port action="http://tpt-ed-chokotei.wdc.com/main/prb/sub/rawdata/error.htm">
Chokeitei
<INPUT type=submit name=sa VALUE="submit"><br>
</FORM>
<?php
//$file = fopen('C:\\??????','w+') ;
//$str =   implode("\r\n", $num18); //??????????????txt
//fwrite($file,$str);
//fclose($file);
//date_default_timezone_set('Asia/Bangkok');  //?????????????????????????????????????/?/?
 //$date =date('Y-m-d');
 //mkdir("$date");
 
//unset($file_array) ; echo '<pre>';  //?????????
 //echo 'num0 = '; echo implode(',', $num1); echo '<br>';
 //echo 'Loadcell-1 = '; echo implode(',', $num19); echo '<br>';
 //echo 'Loadcell-2 = '; echo implode(',', $num20); echo '<br>';
 //echo 'Loadcell-3 = '; echo implode(',', $num21); echo '<br>';
 //echo 'Loadcell-4 = '; echo implode(',', $num22); echo '</pre>';
 ?>
 
 
</form>
</html>
 
 
-ขอบคุณครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-19 03:10:24 | 
                        By :
                            mini | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 โค๊ดมันผิด ไวยกรณ์ ที่บันทัด 26 และ 40  
ไม่ต้องครอบ อีกชั้นที่บันทัด 40  มันจะหา object ไม่เจอ แค่ echo $tep เท่านั้น                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-19 09:37:39 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 10 เขียนโดย : Chaidhanan เมื่อวันที่ 2020-09-19 09:37:39 
รายละเอียดของการตอบ ::
  ได้แล้วครับ
 
ขอบคุณมากครับ
 
แล้วถ้าผมต้องการคัดแยกไฟล์ ก่อนนำ เข้า select อะครับ 
โดยแต่ละไฟล์ต่างกันที่ วันที่ และตัวอักษรสุดท้าย ครับ เช่น 
02022020tttnnnE.LEE 
02022020tttnnnN.LEE 
02022020tttnnnE.PCM 
02022020tttnnnN.LEE 
02022020tttnnnE.LHA 
02022020tttnnnN.LEE
 
ต้องการไฟล์ที่ตัวอักษรสุดท้ายเป็น ตัว E อะครับ ไฟล์อื่นไม่เอามาแสดง select 
 
ขอบคุณครับ
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-20 09:41:40 | 
                        By :
                            mini | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
$MT="DATA/";
$tep = []; //เปลี่ยนเป็น array
$type = isset($_POST['type'])? $_POST['type'] : ''; 
// กำหนดค่า default ให้กับ ตัวแปร POST
if (($handle = opendir($MT))) {//????????????
	while ($fn = readdir($handle)) {
		if(preg_match('/.*?\.(LEE|PCM|LHA)$/i',$fn)){ // เอาเฉพาะไฟล์ที่มี นามสกุลตามกำหนด
			$tep[]=$fn;
		}
	}
	closedir($handle);
	exit;
}
if($type>''){
	$file_path = $MT.$type; // $type นำค่ามากจาก $_POST['type']
	$j=0; for( $j; $j<26; $j++){ ${'num'.$j}=[];} //???????????? array	
	$datafile=file($file_path); //ดูจากข้อมูลแล้ว ใช้คำสั่งนี้ดีกว่า อ่านไฟล์ มาเป็น array แยกบันทัดให้ด้วย
	// $i=0; ไม่ต้องใช้ การนำข้อมูลเข้า array เป็นแบบ sequential อยู่แล้ว index ไล่ตามลำดับ
	$target1=[]; $target2=[]; $target3=[]; // ประกาศตัวแปร มารับข้อมูล
	foreach ($datafile as $line){// อ่านข้อมูลมาที่ละบันทัด
		$cols = explode(',', $line); // แยก ข้อมูลแต่ละบันทัด เก็บไว้ใน array
		foreach($cols as $k=>$val){ // loop เพื่อ กำหนด ข้อมูล
			$x='num'.($k+1); // ชื่อ ตัวแปรเริ่มที่ num1 แต่ $k เริ่มที่ 0
			if($k<1){ $$x[]=intval(substr($val,0,-2)); } else
			if($k>16 && $k<22){ $$x[]=intval($val); }  // แปลงบาง field เป็นตัวเลข ซึ่งกํไม่รู้ว่าทำไมต้องแปลง
			else $$x[]=$val;
		}
        $target1[] = 10; 
        $target2[] = 20;
        $target3[] = 30;
		// $i++; 
		closefile($datafile);
	}
}
?><!DOCTYPE HTML>
<html>
<head>
<title>LoadCell</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="X-Ua-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, maximum-scale=3, minimum-scale=0.5" />
<Link rel="stylesheet" href="">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>     
</head>
<body bgcolor="#cccccc">
<form method="get" action=""  >
	<select  name="type"   required>
	<option>-DATA-</option>
<?php foreach($tep as $entry): /* สร้าง list option */
	$slc = ($entry === $type? 'selected ' : ''); // กำหนดให้แสดง รายการที่เลือก
?>
	<option value="<?=$entry?>" <?=$slc?> ><?=$entry?></option>
<?php endforeach; ?>
	</select>   
	<button mxlns ="" type="submit" >Summit</button>
</form>
<?php if($type>''): /* ตรวจสอบ มีการ request กราฟ หรือไม่*/?>
<div id="container" style="min-width: 480px; height: 520px; margin: 0 auto;"></div>       
<script>
$(document).ready(()=>{ 
	// เปลี่ยนใช้คำสั่งนี้ ดีกว่า หรือ เมื่ออยู่ท้ายไฟล์ ไม่ต้องใช้ก็ได้ 
	// เป็นคำสั่งให้ทำงานเมื่อโหลดข้อมูลเสร็จแล้ว เหมือน body onload
	$('#container').highcharts({
		chart: { type: 'line'  }, //????????? ??????? ??????????????? line ???????? 
		title: { text: 'Lode cell monitor' }, //????????
		xAxis: { categories: ['<?= implode("','", $num1); ?>'] }, //????????? x  
		yAxis: { title: { text: 'Load cell value' }},
		tooltip: {
			enabled: false,
			formatter: function() {
				return '<b>'+ this.series.name +'</b><br/>'+
					this.x +': '+ this.y ;
			}
		},
		legend: {	layout: 'vertical',	align: 'right',	verticalAlign: 'top',	x: -0,	y: 90,	borderWidth: 0},
		plotOptions: {
			line: {
				dataLabels: {
					//enabled: true //????????????????????    
				},
				enableMouseTracking: false
			}   
		},
		series: [
			{name: 'loadcell-1',	color: '#0066FF',	data: [<?= implode(',', $num19)?>]}, 
			{name: 'loadcell-2',	color: '#FF6600',	data: [<?= implode(',', $num20)?>]}, 
			{name: 'loadcell-3',	color: '#33CC00',	data: [<?= implode(',', $num21)?>]}, 
			{name: 'loadcell-4',	color: '#990033',	data: [<?= implode(',', $num22)?>]}, 
			{name: 'target : 10',	color: '#FF0033',	dashStyle: 'ShortDash',	data: [<?= implode(',', $target1)?>]}, 
			{name: 'target : 20',	color: '#FF0033',	dashStyle: 'ShortDash',	data: [<?= implode(',', $target2)?>]}, 
			{name: 'target : 30',	color: '#FF0033',	dashStyle: 'ShortDash',	data: [<?= implode(',', $target3)?>]}
		] // ?????? array ??? y
	});
});
</script>
<?php endif; ?>
</body>
</html>
 
อ่าน วิเคราะห์ และ ประยุกต์เอานะครับ                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2020-09-20 11:01:33              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-20 10:58:38 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 14 เขียนโดย : Chaidhanan เมื่อวันที่ 2020-09-20 10:58:38 
รายละเอียดของการตอบ ::
  ขอบคุณมากครับ
 
ถ้าอยากตรวจสอบที่ไม่ใช่นามสกุลไฟล์อะครับ ตรวจเป็นตัวอักษรที่มี E หรือ L แทนอะครับ เช่น
 
02022020tttnnnE 
02022020tttnnnN 
02022020tttnnnL 
02022020tttnnnN 
02022020tttnnnE 
02022020tttnnnL 
02022020tttnnnE 
02022020tttnnnF 
02022020tttnnnE 
02022020tttnnnT 
02022020tttnnnL 
02022020tttnnnZ
 
เพื่อให้แสดงเฉพาะไฟล์ที่มีตัวอักษร E หรือ L ที่อยุ่ในบรรทัดสุดท้ายของไฟล์ หรือบรรทัดที่ 17  ครับ 
ขอบคุณมากครับ
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-20 13:17:25 | 
                        By :
                            mini | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ความยาว 02022020tttnnn = 14 
Code (PHP) 
if( preg_match('/^.{14}[EL].*/', $line)){
  //..... 
}
//หรือ
if( in_array( substr($line,14,1), ['E','L'])) {
  //.....
}
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2020-09-20 14:09:01 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 สอบถามครับ 
 
เมื่อ $_POST ส่งมาแล้ว โดยที่ ข้อมูลที่ส่งมาว่างเปล่า 
 จะเขียน code ยังไงให้มองข้ามส่วนที่ไม่มีข้อมูล และไปอ่าน ข้อมูลใน $_POST อื่นแทนครับ 
เนื่องจาก รับข้อมูลแล้ว code ฟ้องบรรทัดที่ไม่มีข้อมูล ครับจะข้ามไปได้ยัง 
Code (PHP) 
$datafile=file($_POST["type3"]);//?????????????? 
for($i=0; $i<26; $i++){ ${'Wap'.$i}=array();} //???????????? array
             
$i = 0;
     foreach ($datafile as $line){//??????????????
list($Wap1[$i],$Wap2[$i],$Wap3[$i],$Wap4[$i],$Wap5[$i],$Wap6[$i],$Wap7[$i],$Wap8[$i],$Wap9[$i],$Wap10[$i],$Wap11[$i],$Wap12[$i],$Wap13[$i],$Wap14[$i],$Wap15[$i],$Wap16[$i],$Wap17[$i],$Wap18[$i],$Wap19[$i],$Wap20[$i],$Wap21[$i],$Wap22[$i],$Wap23[$i],$Wap24[$i],$Wap25[$i],) = explode(',', substr($line,0));  //??????????? array 
       $Wap1[$i] = intval(substr($Wap1[$i],0,-2));
       $Wap18[$i] = intval($Wap18[$i]); //???? colum ??????????????
       $Wap19[$i] = intval($Wap19[$i]);
       $Wap20[$i] = intval($Wap20[$i]);
       $Wap21[$i] = intval($Wap21[$i]);
       $Wap22[$i] = intval($Wap22[$i]);
       $target1[$i] = 10;
       $target2[$i] = 20;
       $target3[$i] = 30;
   $i++;
}
 
ฟ้องตรง $datafile=file($_POST["type3"]); เนื่องจากข้อมูลที่ส่งมาไม่มี  จึงอยากไห้ข้ามไป $_POST อื่นแทนครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2021-05-05 04:03:12 | 
                        By :
                            เด็กใหม่ | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |