I know that this code below work perfectly, I already tried it and it worked fine for one input type "file", but what if I have 7 inputs type "file"? how to check if one of them is empty or all of them are empty to not upload blank values to the database? thanks in advance.
if ((!($_FILES['image']['name']))) /* If there Is No file Selected*/ {
"Upload SQL status"
} else /* If file is Selected*/ {
"Upload SQL status"
$image = $_FILES['image']['name'];
move_uploaded_file($img,"images/$image");
}
Such as:
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image1" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image2" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image3" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image4" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image5" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image6" />
<input type="file" accept="image/x-png,image/jpeg,image/jpg,image/png"
name="image7" />
Getting the image from the field:
//getting the image from the field
$image1 = $_FILES['image1']['name'];
//getting the image from the field
$image2 = $_FILES['image2']['name'];
//getting the image from the field
$image3 = $_FILES['image3']['name'];
//getting the image from the field
$image4 = $_FILES['image4']['name'];
//getting the image from the field
$image5 = $_FILES['image5']['name'];
//getting the image from the field
$image6 = $_FILES['image6']['name'];
//getting the image from the field
$image7 = $_FILES['image7']['name'];
After click update, I want my other fields also to be updated in the database like this:
$update_restaurant = "update restaurants set
restaurant_name='$name',restaurant_time='$time',
area='$area',cuisine='$cuis',header='$header',
Overview='$overview',Menu='$menu',website='$wb',
facebook='$fb',meals='$meals',payment='$pay', phone='$phone' ,
map='$map_link', maptext='$map_des', img1='$image1', img2='$image2',
img3='$image3', img4='$image4',img5='$image5', img6='$image6',
img7='$image7', mapid='$map_id' where restaurant_id='$update_id'";
Thanks.