Ciao a tutti, sono nuova su questo forum![]()
Sto creando un form che mi permetta di inserire nel db una serie di dati e alcune immagini. Le immagini le uploado in una cartella e nel db rimane il nome dell'immagine.
Ho cominciato con due immagini, il problema è che mi carica solo la seconda immagine, e mette il nome dell'immagine in tutti e due i campi del db![]()
Questo il codice che sto usando:
Qualche anima pia sa dirmi dove sbaglio?codice:$errors = check($_REQUEST['record']); $errors2 = check($_REQUEST['record']); if ($errors != "" && $errors2 != "") { print_form("new_element", $_REQUEST['record'], $errors, $errors2); } else { $errors = ""; if(trim($_FILES['Immagine']['tmp_name']) != "" && trim($_FILES['Immagine']['tmp_name']) != "none") { $ImageName = time(); $ImageName .= ".jpg"; $errors = CreateImage($_FILES['Immagine']['tmp_name'], $img_path.$ImageName, $img_width, $img_height, $jpegquality, 1); } $errors2 = ""; if(trim($_FILES['Immagine2']['tmp_name']) != "" && trim($_FILES['Immagine2']['tmp_name']) != "none") { $ImageName2 = time(); $ImageName2 .= ".jpg"; $errors2 = CreateImage($_FILES['Immagine2']['tmp_name'], $img_path.$ImageName2, $img_width, $img_height, $jpegquality, 1); } if ($errors != "" && $errors2 != "") print_form("new_element", $_REQUEST['record'], $errors, $errors2); else { $query = "INSERT INTO ".$table_name." " ."SET " ."ID_Scheda = Null, " ."Immagine = '".$ImageName."', " ."Immagine2 = '".$ImageName2."', " ."Titolo = '".addslashes($_REQUEST['record']['Titolo'])."', " ."Testo = '".addslashes($_REQUEST['record']['Testo'])."'"; $result = mysql_query($query); if (!$result) {echo "Errore nell'inserimento della scheda film: ".mysql_error()." " .$query; exit();} print_form("new_element", "", "", ""); } }![]()
Grazie in anticipo!

Rispondi quotando
e che funziona perfettamente, il problema è che gestisce una sola immagine. Dato che mi serve gestire più immagini, ho cercato di "moltiplicare" l'upload delle immagini. Il fatto è che questo script prevede anche la modifica e la cancellazione delle immagini e dei dati, che è quello che serve a me...
