| Current Path : /var/www/html/venkat/army1/ |
| Current File : /var/www/html/venkat/army1/leavesubmit.php |
<?php
include("leave.php");
$inouttype = addslashes($_POST['inout']);
$sql = $conn->prepare("SELECT name, designation FROM armymember where army_id = :armyid");
$sql->bindValue(':armyid',addslashes($_POST['armyid']));
$sql->execute();
$row = $sql->rowCount();
while ($row = $sql->fetch()) {
$designation = $row['designation'];
$name = $row['name'];
}
if($inouttype == "Out") {
$a = "0";
$stmt = $conn->prepare("INSERT INTO armyleave(army_id, intype, outtype, type, outdate, designation, name) VALUES (:armyid, :intype, :outtype, :type, :outdate, :desi, :name)");
$stmt->bindParam(':armyid', addslashes($_POST['armyid']));
$stmt->bindParam(':outtype', addslashes($_POST['inout']));
$stmt->bindParam(':type', addslashes($_POST['type']));
$stmt->bindParam(':outdate', addslashes($_POST['date']));
$stmt->bindParam(':intype', $a);
$stmt->bindParam(':desi', $designation);
$stmt->bindParam(':name', $name);
}
else {
$a = "1";
$aa = "0";
$sql = $conn->prepare("SELECT * FROM armyleave where type = :type and intype = :intype and army_id = :armyid order by army_id = :armyid DESC LIMIT 1");
$sql->bindValue(':armyid',addslashes($_POST['armyid']));
$sql->bindValue(':type',addslashes($_POST['type']));
$sql->bindValue(':intype',$aa);
$sql->execute();
$row = $sql->rowCount();
while ($row = $sql->fetch()) {
$id = $row['id'];
}
$stmt = $conn->prepare("update armyleave set intype = :intype, indate = :indate where id = :id");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':indate', addslashes($_POST['date']));
$stmt->bindParam(':intype', $a);
}
$armyid = addslashes($_POST['armyid']);
if($stmt->execute()) {
echo "<b> <center> <font color = 'blue'> <br>SUCCESSFULLY SUBMITTED. CHECK YOUR SUBMISION </font> </center> </b> <br> <br>";
}
$sql = $conn->prepare("SELECT * FROM armyleave where army_id = :armyid order by army_id = :armyid DESC LIMIT 1");
$sql->bindValue(':armyid',$armyid);
$sql->execute();
$row = $sql->rowCount();
while ($row = $sql->fetch()) {
$armyid = $row['army_id'];
$out = $row['outtype'];
$type = $row['type'];
$outdate = $row['outdate'];
$indate = $row['indate'];
$in = $row['intype'];
}
?>
<div align = "center">
<table>
<tr colspan = "3"> <td> <b> YOUR SUBMISSION </b> </td> </tr>
<tr> <td> <br>ARMY ID </td> <td> <br> : </td> <td> <br> <?php echo $armyid ?> </td> </tr>
<tr> <td> <br>TYPE </td> <td> <br> : </td> <td> <br> <?php echo $type ?> </td> </tr>
<tr> <td> <br>OUT DATE </td> <td> <br> : </td> <td> <br> <?php echo $outdate ?> </td> </tr>
<tr> <td> <br>IN DATE </td> <td> <br> : </td> <td> <br> <?php echo $indate ?> </td> </tr>
</table>
</div>
<?php
?>