Advertisement
Guest User

Untitled

a guest
Jun 1st, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4. include '../config.php';
  5.  
  6. if(!isset($_SESSION['year']))
  7. {
  8.     $year = date("Y");
  9. } else {
  10.     $year = $_SESSION['year'];
  11. }
  12.  
  13. $id = $_SESSION['id'];
  14.  
  15.  
  16. if(!isset($_POST['checkall']))
  17. {
  18.     $check = $_POST['checkbox'];
  19. }
  20. else
  21.     {
  22.         $check = $_POST['checkall'];
  23.         $check = explode(" ",$check);
  24.     }
  25.  
  26. $code = $_POST['code'];
  27.  
  28. for($i = 0;$i < sizeof($check);$i++)
  29. {
  30.     //$query = mysql_query("update checklist set check_status = '1' where check_id = '$check[$i]'") or die(mysql_error()); 
  31.     $query = mysql_query("insert into directorate_kpi (kpi_code) values ('$code[$i]')");
  32. }
  33.  
  34.  
  35. if($query){
  36.    
  37.     ?>
  38.     <script language="JavaScript">
  39.     alert("Successfully Approved KPI");
  40.     document.location="./dirkpiapp.php?id=<?php echo $id; ?>";
  41.     </script>
  42.     <?php
  43. }
  44.  
  45.  
  46. /*$queryweight = mysql_query("select sum(kpi_weight) from corporate_kpi where kpi_status = 'Approved'");
  47. $fetchweight = mysql_fetch_array($queryweight);
  48.  
  49. $weight = $fetchweight[0];
  50. $sum = 0;
  51. for($j = 0;$j < sizeof($_POST['weight']);$j++)
  52. {
  53.     $totalsum = $weight + $_POST['weight'][$j];
  54. }
  55.  
  56. if($totalsum > 100)
  57. {
  58. ?>
  59. <script>
  60.     alert("Weight more than 100% cannot approve anymore, try review again");
  61.     window.location.href="dirkpiapp.php";
  62. </script>
  63. <?php
  64. } else {
  65. */
  66.  
  67.  
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement