Ejemplo n.º 1
0
    $idApartament = $_GET['id'];
    $idOferta = $_GET['idOferta'];
}
if (isset($_POST['submit'])) {
    $postlist = array_keys($_POST);
    foreach ($postlist as $variable) {
        if ($variable != "submit") {
            ${$variable} = $_POST[$variable];
        }
    }
    //print_r($_POST);
    if (!empty($_FILES)) {
        foreach ($_FILES as $key => $file) {
            if ($file['error'] != 4) {
                $foto = new Foto();
                if ($foto->attach_file($file)) {
                    $foto->idApartament = $idApartament;
                    $detalii = "Detalii" . $key;
                    $foto->Detalii = ${$detalii};
                    $ordin = "Ordin" . $key;
                    $foto->Ordin = ${$ordin};
                    $schita = "Schita" . $key;
                    $foto->Schita = ${$schita};
                    $privat = "Privat" . $key;
                    $foto->Privat = ${$privat};
                    if ($foto->save()) {
                        $message .= "";
                    } else {
                        foreach ($foto->errors as $error) {
                            $message .= $error . "(" . $file['name'] . ");";
                        }