0

..............................

<form action="introducere.php" method="POST" enctype="multipart/form-data">

..............................

<td>Picture 1:<input id="picture1" name="picture1" type="file"><br>
Picture 2:<input id="picture2" name="picture2" type="file"><br>
Picture 3:<input id="picture3" name="picture3" type="file"> </form>

..............................

introducere.php
............................

if(isset($_FILES['picture1'])){
    $file = $_FILES['picture1'];
    $file_name = $file['name'];
    echo $file['name'];
    $picture1 = $file['name'];
    if(!$picture1){//if no picture browsed
        $picture1="NULL";
    }
}

if(isset($_FILES['picture2'])){
    $file2 = $_FILES['picture2'];
    $file_name2 = $file2['name'];
    echo $file2['name'];
    $picture2 = $file['name'];
    if(!$picture2){//if no picture browsed
        $picture2="NULL";
    }
}

if(isset($_FILES['picture3'])){
    $file3 = $_FILES['picture3'];
    $file_name3 = $file3['name'];
    echo $file3['name'];
    $picture3 = $file['name'];
    if(!$picture3){//if no picture browsed
        $picture3="NULL";
    }
}

If I Browse 3 pictures, when I echo them, 3 different names appear. But when I insert them in database, only the 1st picture is inserted everywhere. Could you please explain where am I mistaking? Thank you!

$query = "INSERT INTO news(data_stire,
nume_stire,
decriere,
continut_stire,
poze_stire,
poze_stire2,
poze_stire3,
poze_stire4,
poze_stire5,
poze_stire6,
poze_stire7,
poze_stire8,
poze_stire9,
poze_stire10,
poze_stire11,
poze_stire12,
poze_stire13,
poze_stire14,
poze_stire15,
poze_stire16,
poze_stire17,
varianta_pdf,
stire_importanta)
VALUES('$data2','$titlu','$descriere','$stire','$picture1','$picture2','$picture3','$poza4',
'$poza5','$poza6','$poza7','$poza8','$poza9','$poza10','$poza11','$poza12',
'$poza13','$poza14','$poza15','$poza16','$poza17','$fisier_pdf','$importanta');";

.....................................

Edited by kyupa.suria: mistaken names

2
Contributors
1
Reply
7
Views
2 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.