CODE (THERE IS NO DISPLAY FOR THIS PAGE)
<?php $posted_variable= $_POST[posted_field];//post the information from the form page used to query the database for a specific set of information (usually an id) //set variables to connect to the database $hostName = "(FILL IN HOSTNAME FOR DB)"; $userName = "(FILL IN USERNAME FOR DB)"; $password = "(FILL IN PASSWORD FOR DB)"; $dbName = "(FILL IN DB NAME)"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); //query the table for the posted variable to form a list of rows that may be changed based on the checkbox selections $query_1 = "SELECT * FROM (FILL IN TABLE NAME) WHERE (INSERT FIELD NAME)= '$posted_variable'"; $result_1 = mysql_query($query_1); $number_1 = mysql_numrows($result_1); //set up a while loop to look at each row individually and update the necessary field if the checkbox is selected for the viewed row $i=0; while($i<$number_1) { //get the result of the query for the field to be updated $field = mysql_result($result_1,$i, 'field'); //if field is null, (won't overwrite any fields with a value) if($field=='') { //get the field necessary for identifying the row $field2 = mysql_result($result_1,$i, 'field2'); //because the checkbox names are based on values from database fields, those same values must be used to get the checkbox posts $query_2 = "SELECT * FROM (FILL IN TABLE NAME) WHERE (INSERT FIELD NAME)= '$field2'"; $result_2 = mysql_query($query_2); $cb_name_value = mysql_result($result_2,0, 'cb_name_field'); //inside the while (to catch of the values used for the check boxes on the form page) post the variable from the checkbox $entered_value= $_POST['cb_'.$cb_name_value]; //if the checkbox is checked, update the field in the database if($sent_uva=='1') { //update the field in the database for the current row in the while loop $query_update = "UPDATE (FILL IN TABLE NAME) SET field= '$entered_value' WHERE field2= '$field2'"; $result_update = mysql_query($query_update); } } $i++; } //once the page is complete move on to a new page header('Location:(INSERT NAME OF NEXT PAGE)'); ?>