'Male', 'F'=>'Female'); // Has the form been submitted? switch ($_REQUEST["___p"]) { case FALSE: // No, the form has not been submitted, so initialize it $_REQUEST["data"] = $friends; break; default: // Iterate through the submitted form foreach ((array)$_POST["data"] AS $friendID=>$friend) { $query = "UPDATE LOW_PRIORITY Friends " . "SET Name='" . mysql_escape_string($friend["Name"]) . "', " . " Weight='" . mysql_escape_string($friend["Weight"]) . "', " . " Height='" . mysql_escape_string($friend["Height"]) . "', " . " Sex='" . mysql_escape_string($friend["Sex"]) . "' " . "WHERE ID='" . mysql_escape_string($friendID) . "' "; mysqli_query($link, $query); } // Isn't really necessary, but make sure that $friends matches what was just submitted anyway $friends = $_POST["data"]; break; } // Create the form ?>