OK here is the scenario...
I have a page that echos out a list of tasks - about 100 of them. Each task has a checkbox that indicates that task is complete. (in the db it changes from a 0 to a 1). What I want is someone to be able to check off say 5, 10, 20 of the items and click submit. The problem is I am not sure how to do this - each item has a number
say task_id 1 - open the door
task_id 2 - walk in
task_id 3 - turn around
...
task_id 100 - close door
If the user checks items 1,2,3 how do I insert this - I would guess some sort of loop that runs through each ID and changes the value to 1... but Im not sure how to go about that... or even if I am on the right track.
<FORM ACTION="tsecomplete.php">
<blockquote>
<?php
$db = mysql_connect("$server", "$user", "$password");
mysql_select_db('mentor', $db) or die ('Cannot connect to $db_Database : ' . mysql_error());
$id = $_GET['id'];
$result = mysql_query ("SELECT tse.tse_id, tse.tse_name, tasks.tasks_id, tasks.tasks_task, tasks.tasks_week, tasks.tasks_day, tasks.tasks_order
FROM tse, tasks
WHERE tse.tse_id = $id
ORDER BY tasks.tasks_week, tasks.tasks_day, tasks.tasks_order") or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$tasksans_id = $row['tasksans_id'];
$tasks_tsedone = $row['tasks_tsedone'];
$tasks_date = $row['tasks_date'];
$tasks_mdone = $row['tasks_mdone'];
$tasks_id = $row['tasks_id'];
$tasks_task = $row['tasks_task'];
$tasks_week = $row['tasks_week'];
$tasks_day = $row['tasks_day'];
$tasks_order = $row['tasks_order'];
$tasks_add1 = $row['tasks_add1'];
$tasks_add2 = $row['tasks_add2'];
$tasks_add3 = $row['tasks_add3'];
$tasks_add4 = $row['tasks_add4'];
$tse_id = $row['tse_id'];
$tse_name = $row['tse_name'];
$tse_weekorder = $row['tse_weekorder'];
$weeks_id = $row['weeks_id'];
$weeks_1 = $row['weeks_1'];
$weeks_2 = $row['weeks_2'];
$weeks_3 = $row['weeks_3'];
$weeks_4 = $row['weeks_4'];
if($count==0){
print'<br /><br /><center><b>TSE '.$tse_name.'</b></center>';
$count=1;
}
if ($tasks_week != $previous_tasks_week){
print '<br /><H3>Week ' . $tasks_week . '</H3><br />';
$previous_tasks_week = $tasks_week ;
}
if ($tasks_day != $previous_tasks_day){
print '<br /><b>Day ' . $tasks_day . '</b><br /><br />';
$previous_tasks_day = $tasks_day ;
}
if ($tasks_id != $previous_tasks_id){
print '<table width="90%" cellspacing="3" cellpadding="3" border="0"><tr><td width="30%" height="1">' . $tasks_id . ' - ' . $tasks_task . '</td><td halign="left" width="30%" height="1"><INPUT TYPE=CHECKBOX NAME="' . $tasks_id . '"" VALUE="1""> complete</td></tr></table>';
$previous_tasks_id = $tasks_id ;
}
}
?>
<br /><br />
<INPUT TYPE=SUBMIT VALUE="submit">
</FORM>
</blockquote>
<br /><br />
</BODY>
</HTML>
what is supposed to happen....
each task has an id (task_id) anything that is checked i want to update the status in the db from a 0 to a 1. So the question is this... since every item is task_id how do I update multiple tasks to status 1?