$n=sizeof($_POST['protectMean']);
for($i=0;$i<$n;$i++)
{
$qty=$_POST['protectMean'][$i];
$update= $GLOBALS['pdo']->prepare
("UPDATE protect_means SET nameOfMeans = :value1 WHERE personSurname = :order_surname");
$update->bindParam(':value1', $qty);
$update->bindParam(':order_surname', $order_surname);
$update->execute();
}
foreach ($_POST as $k => $v)
{
if (preg_match(/^ProtectMean_(\d+)$/, $k, $r))
{
$update= $GLOBALS['pdo']->prepare("UPDATE protect_means SET nameOfMeans=:value1 WHERE ID=:ID");
$update->bindParam(':value1', $v);
$update->bindParam(':ID', $r[1]);
$update->execute();
}
}