prepare($sql); foreach($_POST['start-h'] as $k => $h_start) { if($h_start != '--') { $m_start = $_POST['start-m'][$k]; $start = sprintf($format, $date[2], $date[1], $date[0], $h_start, $m_start); $h_finish = $_POST['finish-h'][$k]; $m_finish = $_POST['finish-m'][$k]; $finish = sprintf($format, $date[2], $date[1], $date[0], $h_finish, $m_finish); $stmt->execute(array($_SESSION['user'], $start, $finish)); } } } ?> @work