File manager - Edit - /home/autoph/public_html/pms_v1/mar/saveEmpMarHeader.php
Back
<?php include_once("../../../cfg/conn.php"); if(isset($_POST['saveMARH'])){ $SelectedRecordID = $_POST['SelectedRecordID']; $marSemester = $_POST['marSemester']; $marMonths = $_POST['marMonths']; $applyYear = $_POST['applyYear']; $marName = $_POST['marName']; $groupKRAid = $_POST['groupKRAid']; $userID = $_POST['userID']; //Check if same KRA has been added $kraCode $chkKRA = "SELECT * FROM `mar_emp_header` WHERE `deleted`='0' AND `mar_year`='$applyYear' AND `emp_id`='$SelectedRecordID' AND `mar_month`='$marMonths'"; $getDoubleKRA = mysqli_query($conn,$chkKRA); $statRow = mysqli_num_rows($getDoubleKRA); if($statRow > 1){ $errorMessage = "Transaction Failed: <br> You cannot have more than two (2) MAR in a month. "; $fColor = "red"; }else{ $sql = "INSERT INTO mar_emp_header ( `id`, `emp_id`, `pcp_id`, `mar_year`, `mar_month`, `mar_group`, `mar_description`, `date_created`, `created_by`) VALUES ('', '$SelectedRecordID', '$groupKRAid', '$applyYear', '$marMonths', '$marSemester', '$marName', '$myTimeStamp', '$userID')"; if ($conn->query($sql) === TRUE) { //echo '<script type="text/javascript">alert("Success: New record has been added' . $statRow . '");</script>'; $errorMessage = "Success: New record has been added"; $fColor = "#0573A7"; } else { //echo "Error: " . $sql . "<br>" . $conn->error; } } $getKRAList = "SELECT * FROM `mar_emp_header` WHERE `deleted`=0 AND `pcp_id` ='$groupKRAid' ORDER BY `mar_month` ASC"; //$getAreaList = "SELECT * FROM `pms_area_tbl` WHERE deleted ='0'"; $getKRA = mysqli_query($conn,$getKRAList); $statRow = mysqli_num_rows($getKRA); if($statRow > 0){ while($row = mysqli_fetch_array($getKRA)){ $fontColor="#02470A"; ?><tr onclick="javascript:getMARDataList(this);" ><?php echo "<td style='width:10%;color:$fontColor'>".$row['id']."</td>"; echo "<td style='width:10%;color:$fontColor''>".$row['mar_year']."</td>"; echo "<td style='width:10%;color:$fontColor''>".$row['mar_month']."</td>"; echo "<td style='width:10%;color:$fontColor''>".$row['mar_group']."</td>"; echo "<td style='width:50%;color:$fontColor''>".$row['mar_description']."</td>"; echo "<td style='width:5%'>";?> <!--<abbr title='View KRA'><i class='fa fa-plus-circle' aria-hidden='true' style='cursor:pointer;color:green;float:right;font-size:18px'></i> </abbr>--> <i data-toggle="modal" data-target="#viewMARData" class="fa fa-list-ol" style='cursor:pointer;color:green;float:right;font-size:14px'></i> <?php echo "</td>"; echo "<td style='width:5%'>";?> <i data-toggle="modal" class="fa fa-times" style='cursor:pointer;color:red;float:right;font-size:14px'></i> <?php echo "</td>"; echo "<tr>"; } echo "<tr>"; echo "<td colspan='7' style='text-align:left;color:$fColor;'>".$errorMessage."</td>"; echo "</tr>"; } $conn->close(); } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings