Bonjour,
Been hunting the internet to find a solution myself, but instead thought I'd just ask on here. After all, if you don't ask, you don't get.
Basically, I am creating a internal web based e-mail generator for the company I work for, that will send an e-mail to 'handover' certain 'tasks' to the next team on the next shift - It will be used internal only, so please excuse some of the sloppy coding but we only need it to 'work' - Doesn't really matter how!
Anyway, the when someone goes through the form, they are given the options to add 'tasks' to the e-mail, these 'tasks' gets stored into a MySQL database, with the 'DONE' value of '0', ready for when the next person goes to generate the 'handover' - When the next person goes to generate the 'handover', they get a list of the 'tasks', that were previously inserted, by the previous person. Like so:
They are given the option to mark the task as done, or not.
Now here's the part where I get stuck...
The subsequent 'handover' queries the MySQL database to see which 'tasks', have a 'DONE' value of '0' (not done). It then lists them. Here is the code:
$toq2= mysql_query("SELECT * FROM tasks WHERE done='0'");
$toq2p = mysql_fetch_array( $toq2 );
$toq2r = mysql_num_rows( $toq2 );
if ($toq2r >= 1)
{
echo "<table border='0'><tr><td></td><td></td><td></td><td><img src='/assets/tick.png' width='20px' height='20px' border='0' /></td>";
$toq4= mysql_query("SELECT * FROM tasks WHERE done='0'");
while($toq4p = mysql_fetch_array( $toq4 )) {
echo "<font color='black' size='2'><tr><td><font size='2'><strong>{$toq4p['system']}</strong></font> - </td><td><font size='2'><em>{$toq4p['region']}</em></font> - </td><td><font size='2'>{$toq4p['description']}</font></td><td><input type='checkbox' name='todo1[]' value='1'></td></font></tr>"; }
echo "</table><br />";
}
else
{
echo "<h3><font color='red'>NOTHING TO HANDOVER</font></h3>";
}
Problem I have, is that because the amount of tasks is never consistent, I can't have a set query for the amount of values, therefore I need to find a way to dynamically set each row to update the 'done' value in the MySQL table to '1' if the box is ticked and leave it as '0', if the box isn't ticked.
I hope I've explained myself well enough and appreciate any help that anyone can provide.
Many thanks,
P.S: Tasks are created as needed and are NOT in a schedule.. as so:
When inserted from here, the value of 'done' is set to '0' - From the task list (picture in original post), if the person ticks the checkbox, I want it to be able to update that value of 'done' to '1'.