I have created a form to upload multiple images and text to the database.
The Insert script:
include 'config.php';
$prodName=$_POST['prodName'];
$location="upload/";
$file1=$_FILES['img1']['name'];
$file_tmp1=$_FILES['img1']['tmp_name'];
$file2=$_FILES['img2']['name'];
$file_tmp2=$_FILES['img2']['tmp_name'];
$data=[];
$data=[$file1,$file2];
$images=implode(' ',$data);
$prodID = mysqli_real_escape_string($db, $_POST['prodID']);
$null = null;
$query="insert into overview (prodID,prod,prodName,imageProd)
values('$prodID','$null','$prodName','$images')";
$fire=mysqli_query($db,$query);
if($fire)
{
move_uploaded_file($file_tmp1, $location.$file1);
move_uploaded_file($file_tmp2, $location.$file2);
move_uploaded_file($file_tmp3, $location.$file3);
move_uploaded_file($file_tmp4, $location.$file4);
echo "success";
}
else
{
echo "failed";
}
}
The images are successfully uploaded and stored into one field
there are two images: PNG_trans.png and aa.jpg
How do I display/echo these images on my page to make it as a slider/carousel