<?php

$lib = new BusStop();
$przystanek = $lib->getAllBusStop();
$tmp = array();
foreach ($_POST['hours'] as $key => $hour) {
    $tmp[] = $hour . ' ' . $_POST['legend'][$key];
}
$str = implode(';', $tmp);
//echo $str."<br /><br />";
if (!empty($_POST['Save'])) {
    //tutaj zapis
    $hours = implode(';', $_POST['hours']);
    //sklejenie do stringa
    echo $hours;
}
//to sa przykladowe dane o odjazdach
//my oczywiscie wyciagniemy je z bazy :]
$odj = '12:45;13:05;13:54;15:12';
$odj = explode(';', $odj);
if (!empty($_POST['dodaj_odjazdy'])) {
    $tmp = array();
    foreach ($_POST['hours1'] as $key => $hours) {
        $tmp1[] = $hours . ' ' . $_POST['legend1'][$key];
    }
    foreach ($_POST['hours2'] as $key => $hours) {
        $tmp2[] = $hours . ' ' . $_POST['legend2'][$key];
    }
    foreach ($_POST['hours3'] as $key => $hours) {
        $tmp3[] = $hours . ' ' . $_POST['legend3'][$key];
    }