Exemple #1
0
    }
    //Return the data back to formE.php
    echo json_encode($form_data);
}
if (isset($_POST['member'])) {
    $errors = array();
    //To store errors
    $form_data = array();
    //Pass back the data to `formE.php`
    for ($i = 0; $i < count($_POST['member']['k_id']); $i++) {
        $zadatakKorisnik = new ZadatakKorisnik();
        $zadatakKorisnik->korisnik_id = $_POST['member']['k_id'][$i];
        $zadatakKorisnik->zadatak_id = $_SESSION['last_inserted_id'];
        $zadatakKorisnik->created_at = date('YMd hms');
        $zadatakKorisnik->expire_at = date('YMd hms', strtotime($_POST['member']['expire_at'][$i]));
        $zadatakKorisnik->prioritet_id = $_POST['member']['prioritet_id'][$i];
        $zadatakKorisnik->save();
        $komentar = new Komentar();
        $komentar->korisnici_id = $_SESSION['user_id'];
        $komentar->zadatak_id = $_SESSION['last_inserted_id_zk'];
        $komentar->tekst = $_POST['member']['tekst'][$i];
        $komentar->created_at = date('YMd hms');
        $komentar->save();
        $form_data['posted'] = 'Podaci su uspješno upisani u bazu';
    }
    //Return the data back to formE.php
    echo json_encode($form_data);
}
if (isset($_GET['delete'])) {
    Racun::delete($_GET['delete']);
}