How to get value from checkboxes?

The problem is that I can’t get the value from the checkboxes checkbox.

   $result = mysql_query("SELECT name, surname, class_str, class_int, id_school, id FROM datacenter WHERE surname = '$surname_parent' AND type = 'scholar' AND id_school IN ('$id_school', '$id_school1')");
  while ($row = mysql_fetch_array($result))
echo '<input class="i_parent" type="checkbox" name="sold[]" value='.$row[5].' >';
echo '<p class="s_parent">';
echo $row[0].' '.$row[1].' '.$row[2]. '-' . $row[3];

On another page, I need to get the value.
And then put them into the database.
Tried this

      print_r( $_POST['name'] );

but it only reads one value

Answer 1, authority 100%

Your input has the attribute name = sold[], which means that in order to get it, you need to look at $_POST[‘sold’]. Before that, somewhere above, a form should be opened indicating the post method

Answer 2, authority 100%

The Nth element (or named N) can be accessed like this

$_POST['sold'][N] = ($_POST['sold']['N'])

If you need to get all the checkboxes submitted by the form, run in a loop

echo $_POST["sold"][$i];