[CODE]====================== $Priority = $_POST['Priority'][$i]; $EmailAddress = $_POST['EmailAddress'][$i]; //REM KEY field $cBox = isset($_POST['Change'][$i]); //REM: This is the CheckBox field $PersMsg = mysql_escape_string($_POST['PersMsg'][$i]); //REM: TEXTAREA field $pMsg = 'x'; // REM for testing -- can disable TEXTAREA update $PrioritySS = stripslashes($Priority); $EmailAddressSS = stripslashes($EmailAddress); $todays_date = date("Y-m-d"); $today = strtotime($todays_date); $eol = "\r\n"; // connect to the database and select the correct database mysql_connect($hostname,$username,$password) or die(mysql_error()); @mysql_select_db($database) or die( "Unable to select database" . mysql_error()); // find out how many records there are to update and report total number on-screen... $size = count($_POST['Priority']); echo "Counted " . $size . " records to update.
" . $eol; // start a loop in order to update each record $i = 1; //REM: Start with 1 on-screen enumeration does not start with zero while ($i < $size + 1) { // define each variable $Change = ($_POST['Change'][$i] == "on") ? 1 : 0 ; //REM: This is needed since empty checkBoxes are not passed to $_POST. $Priority = $_POST['Priority'][$i]; $PersMsg = $_POST['PersMsg'][$i]; $EmailAddress = $_POST['EmailAddress'][$i]; //REM: On-Screen result report (comment-out when volume exceeds "nnn") echo $i . ": cb is: " . $Change . " Updating " . $EmailAddress . " to Priority: " . $Priority . "
" . $eol; // do the update if($Change == 1) { $uQuery="UPDATE Recipients SET Priority=$Priority"; if($pMsg != '') {$uQuery.=", PersMsg='$PersMsg'"; } //REM used for testing to temporarily disable TEXTAREA update. $uQuery .= " WHERE EmailAddress='$EmailAddress' LIMIT 1"; mysql_query($uQuery) or die ("Error in query: $uQuery"); } ++$i; } mysql_close(); ?> [/CODE]========================