Hi Guru's
This is a continuation of my last post, but I decided to create a new thread for my new question.
Last post click here:
Problem:
How to update a check box value to mysql records
Code submitting the check box
[PHP]
# Print the top of a table or headers
echo "<table width='100%'><tr>";
echo "<td><b>Deadline Feedback</b></td>";
echo "<td><b>Check to approved</b></td>";
echo "<td><b>Date Created</b></td>";
echo "<td><b>Author</b></td>";
echo "<td><b>Requestor</b></td>";
echo "</tr>";
#Print data
while($row = mysql_fetch_assoc($result))
echo "<tr border=10><td>". $row['DeadLineFeedback']. "</td>";
#Here where I place the checkbox
echo "<td><input type=\"checkbox\" name=\"approved_$id\"></td>";
echo "<td>". $row['Created']. "</td>";
echo "<td>". $row['Author']. "</td>";
echo "<td>". $row['Requestor']. "</td>";
echo "</tr>";
[/PHP]
Code updating the check box
[PHP]
# assigning the checbox rows
$approved = $_POST['approved_$id'];
# This is where I'm having trouble how to tell my php code to pick the checked box
$query = "update fileStorage set approved='Y' where $approved=approved_$id";
# Execute the query
$result = mysql_query($query, $dbLink);
# Check if it was successfull
if($result)
{
echo "Success! Your file was updated!";
}
else
{
echo "Error! Failed to update";
echo "<pre>". mysql_error($dbLink) ."</pre>";
}
[/PHP]
Note:
Approved value = 'Y' or 'N' only