I need to upload 5 images at ones with they labels I have made this before to upload many images at one it works fine but I need to have an label for each image how this can be done
take a look at my code.
this is the HTML code
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<?php if(isset($_GET['msg'])){$msg=$_GET['msg']; echo $msg;} ?>
<span style="font-weight: bold; color: #F00;">*ملحوظة </span>الصورة الأولي التي سترفع ستكون صورة المشروع الأساسية نرجوا أختيارها بعناية
<p><label for="img1">صورة 1</label>
<input type="file" name="img[]" id="fileField1" />
<input type="text" name="Limage1" id="Limage1" placeholder="Add label">
</p>
<p><label for="img2">صورة 2</label>
<input type="file" name="img[]" id="fileField2" />
<input type="text" name="Limage2" id="Limage2" placeholder="Add label">
</p>
<p><label for="img3">صورة 3</label>
<input type="file" name="img[]" id="fileField3" />
<input type="text" name="Limage3" id="Limage3" placeholder="Add label">
</p>
<p><label for="img4">صورة 4</label>
<input type="file" name="img[]" id="fileField4" />
<input type="text" name="Limage4" id="Limage4" placeholder="Add label">
</p>
<p><label for="img5">صورة 5</label>
<input type="file" name="img[]" id="fileField5" />
<input type="text" name="Limage5" id="Limage5" placeholder="Add label">
</p>
<p><input type="submit" name="submitCon" id="submitCon" value="Upload More Images">
<input type="submit" name="submit" id="submit" value="I am Finished"></p>
</form>
and this is my php for uploading the images
<?php
if(isset($_POST['submit'])){
$target = '../images/Projects/';
$num=1;
$projectID=$p;
foreach ($_FILES["img"]["error"] as $key => $error)
{
if ($error==UPLOAD_ERR_OK)
{
$tmp_name = $_FILES["img"]["tmp_name"][$key];
$name = $_FILES["img"]["name"][$key];
move_uploaded_file($tmp_name, "$target/$name");
$putData = "INSERT INTO projects_images (id, image, image_id)VALUE('', '$name', '$projectID')";
$result = $db->query($putData)or die($db->error);
if($result){
header('Location:includes/pan/projects/google/face.php?propid='.$p);
}else{
echo"Error";
}
}
}
}
as shown in the HTML code I have a file to upload images and I have a label for each image which I'd like add
how can I do that?