  | 
              
	              
	                
  
    
	 
        จะป้องกันการเผลอกด ENTER แล้ว SUBMIT แบบฟอร์มได้อย่างไรครับ     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                Code (PHP) 
                <?php
                if(isset($_POST['submit']))
                {
                    $member_prefix=$_POST['member_prefix'];
                    $member_fname=$_POST['member_fname'];
                  
                    $member_address=$_POST['member_address'];
                    $tumbol=$_POST['tumbol'];
                    $amphur=$_POST['ampher'];
                    $province=$_POST['province'];
                    $postcode=$_POST['postcode'];
                  
                    $member_email=$_POST['member_email'];
                    $member_tel=$_POST['member_tel'];
                    $username=$_POST['username'];
                    $password=$_POST['password'];
                    $member_date=date('Y-m-d H:i:s');
					
                                    $error=0;
                                    $sql_check_username=" select * from tb_member";
                                    $sql_check_username.=" where username='$username'";
                                    $numrowusername=$cls_con->select_numrows($sql_check_username);
                                    if($numrowusername>=1){
                                        $error=1;
                                        echo $cls_con->show_message('มีผู้ใช้งานนี้แล้ว');
                                    }
                                    $sql_check_email=" select * from tb_member";
                                    $sql_check_email.=" where member_email='$member_email'";
                                    $numrowemail=$cls_con->select_numrows($sql_check_email);
                                    if($numrowemail>=1){
                                        $error=1;
                                        echo $cls_con->show_message('มีผู้ใช้งานอีเมลล์นี้แล้ว');
                                    }
                                    if($error==0){
                    $sql=" insert into tb_member(member_prefix,member_fname,member_address,tumbol,amphur,province,postcode,member_email,member_tel,username,password,member_date)";
                    $sql.=" values ('$member_prefix','$member_fname','$member_address','$tumbol','$amphur','$province','$postcode','$member_email','$member_tel','$username','$password','$member_date')";
                    if($cls_con->write_base($sql))
                    {
                     echo $cls_con->show_message('บันทึกข้อมูลสำเร็จ');
                     
                     echo $cls_con->goto_page(1,'show_member.php');
                   
                  }
                  else{
                    echo $cls_con->show_message('บันทึกข้อมูลไม่สำเร็จ');
                  }
                }
                }
                ?>
                
        </section><!-- /.content -->
      </div>
      <!-- เนื้อหา -->
       
<?php include('footer.php'); ?>
 
 
  Tag : PHP               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-08-01 14:19:49 | 
                      By :
                          Naya | 
                      View :
                          1122 | 
                      Reply :
                          16 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<script>
$(document).ready(function(){
  $("button[name=submit]").click(function(){
    $("form").submit();
  });
});
</script>
<button type="button" name="submit" class="btn btn-info">บันทึก</button>
                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2018-08-01 14:33:54              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-01 14:33:10 | 
                        By :
                            mongkon.k | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบคุณ คุณ Mongkon.k   ผมใส่ code ไปแล้วครับ แต่มีปัญหาตรงที่มีข้อมูลแล้ว submit ไม่ได้ครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-01 14:53:24 | 
                        By :
                            Naya | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 งงค่ะ จะ submit ไม่ได้ยังไงคะ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-01 15:24:58 | 
                        By :
                            Th@iDev | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 คอนเซ็ป คือ ไม่ต้องการให้ user submit โดยยังไม่ใส่ข้อมูลครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-01 15:32:15 | 
                        By :
                            naya | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 แบบโค้ด สั้น ๆ ครับ 
 
Code (PHP) 
<?php include('header.php'); ?>
 
<style type="text/css">
  .CSSTableGenerator {
  margin:0px;padding:0px;
  width:100%;
  box-shadow: 10px 10px 5px #888888;
  border:1px solid #000000;
  
  -moz-border-radius-bottomleft:0px;
  -webkit-border-bottom-left-radius:0px;
  border-bottom-left-radius:0px;
  
  -moz-border-radius-bottomright:0px;
  -webkit-border-bottom-right-radius:0px;
  border-bottom-right-radius:0px;
  
  -moz-border-radius-topright:0px;
  -webkit-border-top-right-radius:0px;
  border-top-right-radius:0px;
  
  -moz-border-radius-topleft:0px;
  -webkit-border-top-left-radius:0px;
  border-top-left-radius:0px;
}.CSSTableGenerator table{
    border-collapse: collapse;
        border-spacing: 0;
  width:100%;
  height:100%;
  margin:0px;padding:0px;
}.CSSTableGenerator tr:last-child td:last-child {
  -moz-border-radius-bottomright:0px;
  -webkit-border-bottom-right-radius:0px;
  border-bottom-right-radius:0px;
}
.CSSTableGenerator table tr:first-child td:first-child {
  -moz-border-radius-topleft:0px;
  -webkit-border-top-left-radius:0px;
  border-top-left-radius:0px;
}
.CSSTableGenerator table tr:first-child td:last-child {
  -moz-border-radius-topright:0px;
  -webkit-border-top-right-radius:0px;
  border-top-right-radius:0px;
}.CSSTableGenerator tr:last-child td:first-child{
  -moz-border-radius-bottomleft:0px;
  -webkit-border-bottom-left-radius:0px;
  border-bottom-left-radius:0px;
}.CSSTableGenerator tr:hover td{
  
}
.CSSTableGenerator tr:nth-child(odd){ background-color:#aad4ff; }
.CSSTableGenerator tr:nth-child(even)    { background-color:#ffffff; }.CSSTableGenerator td{
  vertical-align:middle;
  
  
  border:1px solid #000000;
  border-width:0px 1px 1px 0px;
  text-align:center;
  padding:9px;
  font-size:12px;
  font-family:Arial;
  font-weight:normal;
  color:#000000;
}.CSSTableGenerator tr:last-child td{
  border-width:0px 1px 0px 0px;
}.CSSTableGenerator tr td:last-child{
  border-width:0px 0px 1px 0px;
}.CSSTableGenerator tr:last-child td:last-child{
  border-width:0px 0px 0px 0px;
}
.CSSTableGenerator tr:first-child td{
    background:-o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%);  background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f) );
  background:-moz-linear-gradient( center top, #005fbf 5%, #003f7f 100% );
  filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f");  background: -o-linear-gradient(top,#005fbf,003f7f);
  background-color:#005fbf;
  border:0px solid #000000;
  text-align:center;
  border-width:0px 0px 1px 1px;
  font-size:14px;
  font-family:Arial;
  font-weight:bold;
  color:#ffffff;
}
.CSSTableGenerator tr:first-child:hover td{
  background:-o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%);  background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f) );
  background:-moz-linear-gradient( center top, #005fbf 5%, #003f7f 100% );
  filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f");  background: -o-linear-gradient(top,#005fbf,003f7f);
  background-color:#005fbf;
}
.CSSTableGenerator tr:first-child td:first-child{
  border-width:0px 0px 1px 0px;
}
.CSSTableGenerator tr:first-child td:last-child{
  border-width:0px 0px 1px 1px;
}
</style>
   <!-- เนื้อหา -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
 
 
     
        <section class="content-header">
          <h1>
             เพิ่มประเภทสินค้า
           
          </h1>
          
        </section>
        <!-- Main content -->
        <section class="content">
          <form class="form-horizontal" method="post" action="insert_type.php">
                  <div class="box-body">
                    <div class="form-group">
                      <label for="type_name" class="col-sm-2 control-label">ชื่อประเภทสินค้า</label>
                      <div class="col-sm-10">
                        <input type="text" class="form-control" name="type_name" id="type_name" placeholder="ชื่อประเภทสินค้า">
                      </div>
                      </div>
                  </div><!-- /.box-body -->
                  <center>
                    <button type="submit" name="submit" class="btn btn-info">บันทึก</button>
                    <button type="reset" name="reset"  class="btn btn-warning">ยกเลิก</button>
                </center>
                </form>
                <?php
                if(isset($_POST['submit']))
                {
                  $type_name=$_POST['type_name'];
                  $sql=" insert into tb_type(type_name)";
                  $sql.=" values ('$type_name')";
                  
                  if($cls_con->write_base($sql)==true){
                      echo $cls_con->show_message('บันทึกข้อมูลสำเร็จ');
                      echo $cls_con->goto_page(1,'show_type.php');
                  }
                  else{
                    echo $cls_con->show_message('บันทึกข้อมูลไม่สำเร็จ');
                  }
                }
                ?>
        </section><!-- /.content -->
      </div>
      <!-- เนื้อหา -->
       
<?php include('footer.php'); ?>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-01 15:47:49 | 
                        By :
                            ืnaya | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 จาก(PHP) 
<script>
$(document).ready(function(){
  $("button[name=submit]").click(function(){
    $("form").submit();
  });
});
</script>
<button type="button" name="submit" class="btn btn-info">บันทึก</button>
 
 
เป็น(PHP) 
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>HTML Tutorial</title>
<body>
<script>
$(document).ready(function(){
  $("button[name=submit]").click(function(){
    $("form").submit();
  });
});
</script>
<form id="form" name="form" method= "post">
<button type="button" name="submit" class="btn btn-info">บันทึก</button>
</form>
</body>
</html>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-02 08:30:04 | 
                        By :
                            Hararock | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (JavaScript) 
    $('body').keypress(function (e) {
        if (e.keyCode == 13) {
            return false;
        }
    });
                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-02 09:12:19 | 
                        By :
                            mr.win | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ลองค้นคำว่า jquery validate form นะคะ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-02 11:20:55 | 
                        By :
                            Th@iDev | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 สำเร็จแล้วครับ ขอบคุณทุกท่านครับ 
Code (PHP) 
 <div class="box-body">                                     
                    <div class="form-group">
                      <label for="employee_name" class="col-sm-2 control-label">ชื่อพนักงาน</label>
                      <div class="col-sm-10">
                      <input class="form-control" name="employee_name" required="required" type="text" value="<?php echo @$_POST['employee_name'] ?>">
					   </div>
                    </div>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-02 15:17:43 | 
                        By :
                            ืnaya | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ปรึกษา ตอนนี้เริ่มหัวข้อใหม่ไม่ได้แล้ว ไม่รู้ทำผิดกฎอะไรหรือเปล่า                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-04 10:09:03 | 
                        By :
                            naya | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เขียนหัวข้อใหม่ ตั้งแต่เมื่อวาน เย็น ถึงก่อนเทียงวันนี้  4 หัวข้อ ไม่แสดงบนรายการของ PHP ผม login ปกติครับ 
https://www.thaicreate.com/topic/new.html                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-04 13:17:00 | 
                        By :
                            TumGrape | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 กำลังแก้ไขครับ                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-04 13:24:06 | 
                        By :
                            mr.win | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบคุณครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-04 13:32:20 | 
                        By :
                            TumGrape | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 แก้ไขได้แล้วครับ                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-04 13:44:40 | 
                        By :
                            mr.win | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบพระคุณครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-08-06 09:43:51 | 
                        By :
                            TumGrape | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |