  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                  
Code (PHP) 
?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>index</title>
    <link rel="stylesheet" href="node_modules\bootstrap\dist\css\bootstrap.min.css">
</head>
<body>
<?php
	ini_set('display_errors', 1);
  error_reporting(~0);
  
  $strKeyword = null;
    if(isset($_POST["txtKeyword"]))//เซ็ตรับค่าช่องsearch
    {
        $strKeyword = $_POST["txtKeyword"];
    }
    if(isset($_GET["txtKeyword"]))//เซ็ตรับค่าช่องsearch
    {
        $strKeyword = $_GET["txtKeyword"];
    }
    
    
   $serverName = "localhost";//เชื่อมต่อฐานข้อมูล
   $userName = "root";
   $userPassword = "";
   $dbName = "crudsystem";
   $conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
   mysqli_query($conn, "SET CHARACTER SET UTF8");//เซ็ตเป็นเเบบUTF 8 ทำให้อ่านภาษาไทยได้
   $sql = "SELECT * FROM stock WHERE Part LIKE '%".$strKeyword."%' OR Dis LIKE '%".$strKeyword."%'  ";//รับค่าจากฐานข้อมูล เเละ ใช้คำสั่งในการค้นหา
   $query = mysqli_query($conn,$sql);
   $num_rows = mysqli_num_rows($query);
   
   
   $per_page = 3;   // Per Page
   $page  = 1;
   
   if(isset($_GET["Page"]))
   {
     $page = $_GET["Page"];
   }
 
   $prev_page = $page-1;
   $next_page = $page+1;
 
   $row_start = (($per_page*$page)-$per_page);
   if($num_rows<=$per_page)
   {
     $num_pages =1;
   }
   else if(($num_rows % $per_page)==0)
   {
     $num_pages =($num_rows/$per_page) ;
   }
   else
   {
     $num_pages =($num_rows/$per_page)+1;
     $num_pages = (int)$num_pages;
   }
   
 
   $sql .= " ORDER BY id ASC LIMIT $row_start ,$per_page ";
   $query = mysqli_query($conn,$sql);
   
?>
<script type="text/javascript">
			  function fncSubmit()
			  {
				  if(document.getElementById('txtQty').value == 0)
				  {
					  alert('กรุุณาเลือกจำนวนเบิก');
					  return false;
				  }
			  }
			  </script>
 <input class="form-control mr-sm-2" type="text" name="txtKeyword" id="txtKeyword" placeholder="Search" aria-label="Search" value="<?php echo $strKeyword;?>">
    </div>
    <div class="col-mr-auto">
    <input button class="btn btn-outline-success my-2 my-sm-0" type="submit" value="Search"></button>
    </div>
  </form>
</nav>
<table class="table  table-striped table-bordered table-info">
  <thead>
</div>
      <th scope="col">No.</th>
      <th scope="col">Part</th>
      <th scope="col">Dis.</th>
      <th scope="col">Branch</th>
      <th scope="col">QTY.</th>
      <th scope="col">จอง</th>
      <th scope="col"></th>
      <th scope="col">คงเหลือ</th>
    </tr>
  </thead>
  <?php
  if(mysqli_num_rows($query) <1){
  ?>
  <tr>
    <td colspan="8"><div align="center">ไม่พบข้อมูล</div></td>
    
  </tr>
  <?php 
  }else{
while($result=mysqli_fetch_array($query,MYSQLI_ASSOC))
{//เเสดงข้อมูลทั้งหมดที่เราเลือกไว้
?>
  <tbody>
  <form action="receive.php?<?=$result["preface_subject"];?>" method="post" onSubmit="return fncSubmit( this );" >
    <tr>
    <tr>
    <td><?php echo $result["id"];?></div></td>
    <td><?php echo $result["Part"];?></td>
    <td><?php echo $result["Dis"];?></td>
    <td><?php echo $result["Branch"];?></div></td>
    <td><?php echo $result["QTY"];?></td>
	<td><input type="hidden" name="txtProductID" value="<?php echo $result["id"];?>" size="2"> 
                <select id="txtQty" name="txtQty" class="form-control" >
                <td><input type="submit" id="request" name="request" class="btn btn-info btn-sm" value="เบิกวัสดุ"></td>
                <td><?php echo $result["QTY_NOW"];?></td>
          <?php for($qty=0;$qty<=20;$qty++)
         
          
          ?>
          
      
					</select>
    			</td>
				</form>
  </tr>
<?php
}
}
?>
</table>
<center>
<br>
Total <?php echo $num_rows;?> Record : <?php echo $num_pages;?> Page :
<?php
if($prev_page)
{
	echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$prev_page&txtKeyword=$strKeyword'><< Back</a> ";
}
for($i=1; $i<=$num_pages; $i++){
	if($i != $page)
	{
		echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$strKeyword'>$i</a> ]";
	}
	else
	{
		echo "<b> $i </b>";
	}
}
if($page!=$num_pages)
{
	echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$next_page&txtKeyword=$strKeyword'>Next>></a> ";
}
if($page!=$num_pages)
{
	echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$next_page&txtKeyword=$strKeyword'>Next>></a> ";
}
mysqli_close($conn);
?>
    <script src="node_modules\jquery\dist\jquery.min.js"></script>
    <script src="node_modules\bootstrap\dist\js\bootstrap.min.js"></script>
    <script src="node_modules\popper.js\dist\umd\popper.min.js"></script>
    
</body>
</center>
 
QYY = จำนวนสินค้าทั้งหมด 
จอง = คือจำนวนที่ต้องการตัด 
QTY_NOW = คือจำนวนที่เหลือ 
ตรงช่อง จอง ผมกดไม่ได้ 
 
อยากให้เลือกตรงจำนวน QTY - จอง ทำยังไงครับ 
เเล้วก็วิธีปรับสเกลช่องให้พอดีกับคำ 
ใครรู้รบกวนช่วยทีครับ
 
 
  Tag : PHP, Apache, XAMPP               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2019-04-01 11:54:24 | 
                      By :
                          mostc007 | 
                      View :
                          732 | 
                      Reply :
                          4 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  |