php - Grabbing specific variable from while loop for form submit -


i have while loop generating information checkbox, update database new "completed" value. how can select specific checkbox generated. please showing me how can grab specific value of checkbox , task_name.

thanks, ryan

    while ($row = mysql_fetch_array($query)){         $task_name = $row['task_name'] ;         $task_description = $row['task_description'];         $task_completed = $row['completed'];         $tasks .= '<div id="tasksbody">                     <form action="" method="post">completed? <input name="completed" type="checkbox" '.                     ($task_completed == 1?'checked="checked"':'').                     ' /><input type="submit" value="update"><br /><br />                     <b>'.$task_name.'</b><br /><br />'.$task_description.'<hr><br /></form></div>';         } } echo $tasks; 

you need name input unique row, such task_name, or better, database record id.

then when user submits form, use $_post["yourtasknameoridhere"] check value.

what have calls check boxes same thing.


edit: i'm sorry, you're isolating of these in own forms, realized that. can add <input type="hidden" value="$task_name" name="taskname" /> form, can checkbox corresponding to. then, when user submits form, use $_post["taskname"] find out name of task.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -