I want to update a data in mysql. In my sql status is defaulted to "In-Progress" so I want to update that to endorsed or approved if the user click the link inside the gridview.
Here's my code for the datagrid
Code: Select all
<div style="height:70%;">
<?php
$con=mysqli_connect("localhost","root","","leavecalendar");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM leavedetails where username = '$loginuser[username]'");
echo "<table border='1' class='form-table' width='10%'>
<tr>
<th>Leave Type</th>
<th>Start Date</th>
<th>End Date</th>
<th>Reason</th>
<th>Status</th>
<th></th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['typeofleave'] . "</td>";
//echo "<td>" . $row['stardate'] . "</td>";
echo "<td>" . date("m-d-Y", strtotime($row['stardate'])) . "</td>";
//echo "<td>" . $row['endate'] . "</td>";
echo "<td>" . date("m-d-Y", strtotime($row['endate'])) . "</td>";
echo "<td>" . $row['reason'] . "</td>";
echo "<td>" . $row['status'] . "</td>";
echo "<td align='center'><a href=\"\">Cancel</a> | <a href=\"deleteleave.php\">Remove</a></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</div>as you can see here echo "<td align='center'><a href=\"\">Cancel</a> | <a href=\"deleteleave.php\">Remove</a></td>"; if i click the cancel button I want the status in mysql to be updated to endorsed or remove that row in SQL. Please, please I need help since I'm kind of stuck in here for the past 4 days. (Learning can sometimes be a pain specially in my hair)
Can anyone please provide a sample code where I can play around to.
also posted at: http://stackoverflow.com/questions/2311 ... is-clicked and in http://www.webdeveloper.com/forum/forum ... php?16-PHP