<?php if(isset($_POST['salvar'])){ echo "OK<br>"; $checkbox=trim($_POST['pet']); foreach ($checkbox as $id){ echo "ID: ".$id."<br>"; } } else echo "ERROR"; ?>