<form method="post" enctype="multipart/form-data" id="form_wf" name="form_wf" action="insert.php"> $a = 0; $sqldate = db::query("SELECT PER_CODE,PER_IDCARD,PER_FIRSTNAME_TH,PER_LASTNAME_TH, FROM PER_PROFILE JOIN SETUP_POS_LINE ON PER_PROFILE.LINE_ID = SETUP_POS_LINE.LINE_ID"); $sqldate1 = db::fetch_array($sqldate); ?> <link rel="stylesheet" type="text/css" href="../assets/css/sortable.css"> <div class="table-responsive" data-pattern="priority-columns"> <table class="table table-bordered sorted_table " > <thead class="bg-primary"> <tr class="bg-primary"> <th scope="col"></th> <th width="8%" scope="col">รหัสพนักงาน</th> <th width="15%" scope="col">ชื่อพนักงาน</th> </tr> </thead> <?php while($sqldate1 = db::fetch_array($sqldate)){ if($arr_position['YEAR'] >= 60 && $arr_position['YEAR'] < 61 ){ ?> <tbody> <tr> <td style="text-align:center"><input type="checkbox" onClick="get_personnel('<?php echo $sqldate1["PER_CODE"]?>');" /></td> <td><?php echo $sqldate1['PER_CODE'] ?></td> <td><?php echo $sqldate1['PER_FIRSTNAME_TH']." " . $sqldate1['PER_LASTNAME_TH'] ?></td> <td><?php echo $sqldate1['LINE_NAME_TH']. " " . $sqldate1['LEVEL_ID'] ?></td> $array['']{ } </tr> </tbody> <input type="hidden" id="PER_CODE" name="PER_CODE" class="form-control" value="<?php echo $sqldate1['PER_CODE']; ?>"> <input type="hidden" id="PER_NAME" name="PER_NAME" class="form-control" value="<?php echo $sqldate1['PER_FIRSTNAME_TH']; ?>"> <input type="hidden" id="PER_LAST" name="PER_LAST" class="form-control" value="<?php echo $sqldate1['PER_LASTNAME_TH']; ?>"> <?php $a = $a+1;} } ?> </table> <script type="text/javascript"> function get_personnel(id){ window.opener.$('#PER_NAME').val(id); alert(id); } </script> <div class="row"> <div class="col-md-12"> <div class="wf-right"> <button type="submit" class="btn btn-success waves-effect waves-light"><i class="icofont icofont-tick-mark" title=""></i> บันทึก</button> </div> </div> </div> </form>
<?php if(isset($_POST)){ echo $_POST['PER_CODE']; } ?>
/* จัดการ hidden ก่อนส่ง(POST) ไปหน้า insert */ <input type="hidden" id="PER_CODE" name="PER_CODE" class="form-control" value="<?php echo $sqldate1['PER_CODE'];?>"> <input type="hidden" id="PER_NAME" name="PER_NAME" class="form-control" value="<?php echo $sqldate1['PER_FIRSTNAME_TH'];?>"> <input type="hidden" id="PER_LAST" name="PER_LAST" class="form-control" value="<?php echo $sqldate1['PER_LASTNAME_TH'];?>">
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> var keep = new Array(); $(document).ready(function(){ $('input[type="checkbox"]').change(function(){ var i = $('input[type="checkbox"]').index(this); if (typeof keep === 'undefined') { var tmp = ""; $(this).siblings('input[type="hidden"][of="'+i+'"]').each(function(i, e) { tmp += $(e).prop("outerHTML") + "\n"; }); keep[i] = tmp; } else { if (!keep[i].length) { var tmp = ""; $(this).siblings('input[type="hidden"][of="'+i+'"]').each(function(i, e) { tmp += $(e).prop("outerHTML") + "\n"; }); keep[i] = tmp; } } if ($(this).not(":checked").length) { $(this).siblings().remove('input[type="hidden"][of="'+i+'"]'); } else { if (!$(this).siblings('input[type="hidden"][of="'+i+'"]').length) { $(this).siblings("br:last").after(keep[i]); keep[i] = ""; } } }); }); //PhrayaDev@2020 </script> </head> <body> <form> <input type="checkbox" id="chk1" name="chk1" value="of=0" checked> <label for="chk1"> hidden ที่มี of="0"</label><br> <input type="checkbox" id="chk2" name="chk2" value="of=1" checked> <label for="chk2"> hidden ที่มี of="1"</label><br> <input type="checkbox" id="chk3" name="chk3" value="of=2" checked> <label for="chk3"> hidden ที่มี of="2"</label><br><br> <input type="hidden" name="a" value="1" of="0"> <input type="hidden" name="b" value="2" of="0"> <input type="hidden" name="c" value="3" of="0"> <input type="hidden" name="d" value="4" of="1"> <input type="hidden" name="e" value="5" of="1"> <input type="hidden" name="f" value="6" of="1"> <input type="hidden" name="g" value="7" of="2"> <input type="hidden" name="h" value="8" of="2"> <input type="hidden" name="i" value="9" of="2"> <input type="submit" value="Submit"> </form> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง