Jump to content

submitting multiple items on a form


sylunt1

Recommended Posts

I have a form that prints out a list of tasks with a checkbox that the user marks when it is complete.

 

Basically its like this:

 

task 1  task desctiption  []done

task 2  task desctiption  []done

...

task 100  task desctiption  []done

 

Each task has a unique task_id but I am confused how to enter this in the db.

 

I want to be able to take the task_ids that have the check (value of 1) and update the db with this.

 

Example

Tasks 1, 5, 12,and 17 have a check

so where task_id=1 and task_id=5 (etc...) update field to a 1.  I am just not sure how to get here...

 

 

Thanks.

Link to comment
Share on other sites

Here is how I list out the tasks...

 

if ($tasks_id != $previous_tasks_id){

  print '<table width="90%" cellspacing="3" cellpadding="3" border="0"><tr><td width="30%" height="1">' . $tasks_id . '&nbsp- ' . $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 ;

 

}

 

Will this need to be modified as well?

Link to comment
Share on other sites

if ($tasks_id != $previous_tasks_id){
   print '<table width="90%" cellspacing="3" cellpadding="3" border="0">
   <tr>
     <td width="30%" height="1">' . $tasks_id . '&nbsp- ' . $tasks_task . '</td>
     <td halign="left" width="30%" height="1">
        <INPUT TYPE="CHECKBOX" NAME="taskid[]" VALUE="'.$tasks_id.'"> complete
     </td>
   </tr>
   </table>';

   $previous_tasks_id = $tasks_id ;

}
//then maybe you will need to do something like

where id IN(implode(",",$_POST['taskid']))

this?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.