在while循环php中更新数据库记录

I am trying to develop a simple page in php to update attendance days.I have set the query to display the records from db and added a check box with data displayed from db.I want to update the specific record of db on which check box is checked.i want to update the the attendance column with 1 to existing value.for this i just tried written code to display the data from db and added a check box but dnt know to update the record where check box is checked on submit button.here is my initial code.any one help

<?php
require_once("../db/db_connect.php");
$db = new DB_CONNECT();
$sql = "SELECT cv_id, cd_id, cv_fomfeeback FROM candidateverification;";
$res = pg_query($sql) or die ($sql);
    // output data of each row
    while($row = pg_fetch_row($res)){
        echo "cd id: " . $row[0]. "  cv id: " . $row[1]. "  atn: " . $row[2]. "<input type='checkbox' value='1'/> <br>";
    }
 ?>
<html lang="en">

<head>
<body>    
    <input type="button" action="update" value="Submit"/>
</body>

</html>

I want to update cv_fomfeeback column with +1 if check box is checked.

First you need to name your checkbox. You must do this in a way, so that you get all the checkboxes (-> array) and know the row id of the checkes boxes (-> associative array).

Your checkbox could look like this:

echo "<input type=\"checkbox" name=\"boxes[{$row[0]}]\" value=\"1\">";

On the page that is called after submit has been done (see the comment of @TheNAkos) you will find all checked boxes in the associative array accessible via

$_POST["boxes"]

From there you need to loop through the array and update the rows accordingly.

I will not post a complete example, but those hints should help you find the solution by yourself.