I have a form which asks for an image uploaded, title, description etc.
An error appears if no image is selected like this:
if ($_FILES["target_file"]==''){
echo 'Please upload a suitable photograph!<br>';
}
But if i select an image but don't fill in the rest of the form, it will upload it to my database.
I've tried something like this:
if (!empty($_FILES['target_file']) && (empty ($_POST['photo-title'])) && (empty ($_POST['photo-name'])) && (empty ($_POST['uploaded'])) && (empty ($_POST['genreID'])) && (empty ($_POST['description'])))
{
echo 'Please select a photograph!<br>';
}
But this doesn't work.
Any one any ideas on how i can make it display an error after selecting an image but not filling the rest of the form?