<?php $objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database"); $objDB = mysql_select_db("ca_vos"); mysql_query("SET NAMES UTF8"); $strSQL = "UPDATE `ca_plan` SET `show` ='0'"; $strSQL .="WHERE id = '".$_POST["id"]."' "; $objQuery = mysql_query($strSQL); echo "<pre>"; print_r($_POST["id"]); echo "</pre>"; if(!$objQuery){ echo "Error[".$strSQL."]"; } for($i=0;$i<count($_POST["chk"]);$i++) { if($_POST["chk"][$i] != "") { $strSQL = "UPDATE `ca_plan` SET `show` ='1'"; $strSQL .="WHERE id = '".$_POST["chk"][$i]."' "; $objQuery = mysql_query($strSQL); //$strSQL1 .= "UPDATE `ca_plan` SET `show` ='0'"; //$strSQL1 .="WHERE id != '".$_POST["chk"][$i]."' "; //$objQuery = mysql_query($strSQL1); } } mysql_close($objConnect); //header("location:uncheck.php"); ?>
<?php if(isset($_POST['status'])&&isset($_POST['year'])&&isset($_POST['month'])){ $status=$_POST['status']; $year=$_POST['year']; $month=$_POST['month']; if($month==1){ $pre_month=12; }else{ $pre_month=$_POST['month']-1; } }else{ $status=null; $year=null; $month=null; $pre_month=null; } $objConnect = mysql_connect("localhost", "root", "") or die("Error Connect to Database"); $objDB = mysql_select_db("ca_vos"); $sql_date = "SELECT MIN(YEAR(issue_start)) AS Min_year FROM ca_plan"; mysql_query("SET NAMES UTF8"); $result = mysql_query($sql_date); $row = mysql_fetch_array($result); $first_year=$row['Min_year']; $present_date=date("Y"); $total_year=$present_date-$first_year; $select = "select * FROM ca_plan WHERE status = '$status' AND (YEAR(issue_start) = '$year' AND MONTH(issue_start) = '$month' AND DAY(issue_start) BETWEEN '1' AND '31' AND DAY(issue_start) BETWEEN '1' AND '31' )"; $result = mysql_query($select); $total = mysql_num_rows($result); if($total==0){ ?> <center> <br><b><font size="4" color="">Data is Null</font></b><br><br><br> <br><b><font size="3" color="">Select Status Month & Year</font></b><br><br><br> <form action="select1.php" method="post"> <select name="status"> <option value=" " disabled="disabled" selected="selected">Status..</option> <option value="Waiting for CA" <?php if($_POST["status"]=="Waiting for CA"){echo"selected";}?>>Waiting for CA</option> <option value="Waiting for Approve" <?php if($_POST["status"]=="Waiting for Approve"){echo"selected";}?>>Waiting for Approve</option> </select> <?php if(isset($_POST['status'])&&isset($_POST['year'])&&isset($_POST['month'])){ $status=$_POST['status']; $year=$_POST['year']; $month=$_POST['month']; if($month==1){ $pre_month=12; }else{ $pre_month=$_POST['month']-1; } }else{ $status=null; $year=null; $month=null; $pre_month=null; } $objConnect = mysql_connect("localhost", "root", "") or die("Error Connect to Database"); $objDB = mysql_select_db("ca_vos"); $sql_date = "SELECT MIN(YEAR(issue_start)) AS Min_year FROM ca_plan"; mysql_query("SET NAMES UTF8"); $result = mysql_query($sql_date); $row = mysql_fetch_array($result); $first_year=$row['Min_year']; $present_date=date("Y"); $total_year=$present_date-$first_year; ?> <?php echo '<select name="year"> <option value=" " disabled="disabled" selected="selected">Year..</option>'; for($i=0;$i<=$total_year;$i++){ echo '<option value="'.$first_year.'"'; if($first_year==$year){ echo 'selected="selected"'; } echo '>'.$first_year; echo '</option>'; $first_year++; } echo '</select>'; ?> <select name="month"> <option value=" " disabled="disabled" selected="selected">Month..</option> <option value="1" <?php if($_POST["month"]=="1"){echo"selected";}?> >January</option> <option value="2" <?php if($_POST["month"]=="2"){echo"selected";}?> >February</option> <option value="3" <?php if($_POST["month"]=="3"){echo"selected";}?> >March </option> <option value="4" <?php if($_POST["month"]=="4"){echo"selected";}?> >April </option> <option value="5" <?php if($_POST["month"]=="5"){echo"selected";}?> >May </option> <option value="6" <?php if($_POST["month"]=="6"){echo"selected";}?> >June </option> <option value="7" <?php if($_POST["month"]=="7"){echo"selected";}?> >July </option> <option value="8" <?php if($_POST["month"]=="8"){echo"selected";}?> >August </option> <option value="9" <?php if($_POST["month"]=="9"){echo"selected";}?> >September </option> <option value="10" <?php if($_POST["month"]=="10"){echo"selected";}?> >October </option> <option value="11" <?php if($_POST["month"]=="11"){echo"selected";}?> >November </option> <option value="12" <?php if($_POST["month"]=="12"){echo"selected";}?> >December </option> </select> <input type="submit" name="submit" value="Submit" /><BR><BR><BR> </table> <br><br><br><br><br> </form> <center> <?php }else{ ?> <form name="frmMain" action="front.php" method="post" OnSubmit=""> <table width="95%" align="center"> <tr align="center" bgcolor="#a5a5a5"> <td width="2%"></td> <td width="25%"><font size="2" color=""><b>File </b></font></td> <td width="25%"><font size="2" color=""><b>Issue</b></font></td> <td width="20%"><font size="2" color=""><b>Status</b></font></td> <td width="15%"><font size="2" color=""><b>Issue_start</b></font></td> <td width="15%"><font size="2" color=""><b>Issue_end</b></font></td> </tr> <?php while($row2 = mysql_fetch_array($result)) { ?> <tr bgcolor="#d9dade"> <td><div align="center"> <input type="checkbox" name="chk[]" value="<?php echo $row2["id"];?>"<?php if( $row2["show"] == 1 ){ echo 'checked="checked"'; }; ?> > </div></td> <td align="center"> <font size="2" color=""><?php echo $row2['name']; ?></font> </td> <td align="center"> <font size="2" color=""><?php echo $row2['issue']; ?></font> </td> <td align="center"> <font size="2" color=""><?php echo $row2['status']; ?></font> </td> <td align="center"> <font size="2" color=""><?php echo $row2['issue_start']; ?></font> </td> <td align="center"> <font size="2" color=""><?php echo $row2['issue_end']; ?></font> </td> </tr> <?php } ?> <br> </table> <table width="100%"> <tr> <br><br> <center> <a href="javascript:chk_all();"><h4>Select All</a><a href="javascript:unchk_all();"> / Unselect All</h4></a> </center> <br><br> <td width="50%" align="right"><input type="submit" name="btnDelete" style='width:90px; height:30px' onclick="" value="save result"/></td> <td width="50%" align="left"> <input type="button" name="button" style='width:90px; height:30px' id="button" value="Cancel" onclick="javascript:location.href='home.html';"/> </td> </div> </tr> </table> </form> <?php } ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <script src="http://code.jquery.com/jquery-latest.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> </head> <body> <input type="checkbox" id="checkAll" />เลือกทั้งหมด / ไม่เลือกทั้งหมด <br /> <input type="checkbox" name="chk[]" value="A" /> A<br /> <input type="checkbox" name="chk[]" value="B" /> B<br /> <input type="checkbox" name="chk[]" value="C" /> C<br /> <input type="checkbox" name="chk[]" value="D" /> D<br /> <script> $("#checkedAll").click(function(){ if($(this).attr("checked")) $("input[type='checkbox']").attr({"checked":"checked"}); else $("input[type='checkbox']").removeAttr("checked"); }); </script> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <script src="http://code.jquery.com/jquery-latest.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> </head> <body> <input type="checkbox" id="checkAll" />เลือกทั้งหมด / ไม่เลือกทั้งหมด <br /> <input type="checkbox" name="chk[]" value="A" for="sub" /> A<br /> <input type="checkbox" name="chk[]" value="B" for="sub" /> B<br /> <input type="checkbox" name="chk[]" value="C" for="sub" /> C<br /> <input type="checkbox" name="chk[]" value="D" for="sub" /> D<br /> <script> $("#checkAll").change(function(){ // http://code.jquery.com/jquery-latest.js มันเป็นเวอร์ชั้น 2.0 กว่าๆ น่ะครับ if($(this).prop("checked")) $("input[type='checkbox']").prop({"checked":true}); else $("input[type='checkbox']").prop({"checked":false}); /* โค้ดข้างล่างนี้ใช้กับ JQuery ที่ต่ำกว่าเวอร์ชั่น 2.0 if($(this).attr("checked")) $("input[type='checkbox']").attr({"checked":"checked"}); else $("input[type='checkbox']").removeAttr("checked"); */ }); $("[for='sub']:checkbox").click(function(){ if($("[for='sub']:checkbox:checked").length == $(":checkbox").length-1) $("#checkAll").prop({"checked":true}); else if($("[for='sub']:checkbox:checked").length < $(":checkbox").length-1) $("#checkAll").prop({"checked":false}); }); </script> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง