Hello,
I am trying something new and I do not know how to do it. I have table that list all the expenses claim, which these expenses needs to multiple approvals from different managers, where it will be like this:
<?php
$connect = mysql_connect("localhost","root","***") or die ("Could not connect");
mysql_select_db("expenses") or die ("Could not find the database");
$sql = mysql_query("SELECT * FROM expenses_claim");
$expCount = mysql_num_rows($sql); //Count the output amount
echo "<table border='1'>
<tr>
<th>Expense ID</th>
<th>Claimant Date</th>
<th>Details</th>
<th>Department Manager</th>
<th>HR Manager</th>
<th>Approval</th>
<th>Finanace</th>
</tr>";
if ($expCount != 0){
while($row = mysql_fetch_array($sql)){
echo "<tr>";
echo "<!--<td class='approve'><a href='approve.php?approve='></a> <a href='#' class='show_hide toggler'>Add</a></td>-->";
echo "<td>" . $row['exp_id'] . "</td>";
echo "<td>" . $row['claimant_date'] . "</td>";
echo "<td><a href='exp_view.php?exp_id=". $row['exp_id']."?'>View Details</a><input type='hidden' onclick='display' value='show'/></br></td>";
echo "<td><a href='approve.php?approveid=". $row['exp_id']."?'>Approve</a>•<a href='declain.php?exp_id=". $row['exp_id']."?'>Delete</a><br/></div></td>";;
echo "<td><a href='approve1.php?approveid=". $row['exp_id']."?'>Approve</a>•<a href='declain.php?exp_id=". $row['exp_id']."?'>Delete</a><br/></div></td>";
echo "<td><a href='approve2.php?approveid=". $row['exp_id']."?'>Approve</a>• <a href='declain.php?exp_id=". $row['exp_id']."?'>Delete</a><br/></td>";
echo "</tr>";
// $exp_list = print"$exp_id - $claimant_date <a href='exp_view.php?exp_id=$exp_id?'>View</a></br>";
}
echo "</table></form>";
}else{
$exp_list = print "You have no expenses claim listed in the system";
}
mysql_close($connect);
?>
</body>
</html>
And the code in the below show when the manager click on Approve will insert the value into the database
<?php
if (isset($_GET['approveid'])){
echo '<div align="center"><font size="4" color="red">Please confirm your approve of the expense claim no. ' .$_GET['approveid']. '</font><p><p></p></p><br/><a href="approve.php?yesapprove=' .$_GET['approveid'].'">Yes</a> |<a href="list.php">No</a></div>';
}
if(isset($_GET['yesapprove'])){
$approve = $_GET['yesapprove'];
$connect = mysql_connect("localhost","root","****") or die ("Could not connect");
mysql_select_db("expenses") or die ("Could not find the database");
$sql1 =mysql_query("update expenses_claim set man_sign = 'Approved' where exp_id = '$approve'");
header("Location:list.php");
exit();
mysql_close($connect);
}
?>
Once the manager approve I want to replace the value with Approved in the table instead of Approve | Decline. Also, The Approve | Decline options I want to hide them until the first manager approve.
I would be most grateful for any help or suggestion that will be help me in my project