Including everything for uploading a file is going to take a lot of time. This could give you a start.
<?php
$link = mysqli_connect("myhost","myuser","mypassw","mybd") or die("Error " . mysqli_error($link));
if($_POST['submit']) {
$category = $_POST['category'];
$query_insert = "INSERT INTO image_gallery (id, category, image_location) VALUES ('', '$category', 'uploads/".$_FILES['file']['name']."');
$result_insert = mysqli_query($link, $query_insert);
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
}
?>
<form action='' method='POST' enctype='multipart/form-data'>
<?php
$query = "SELECT * FROM image_gallery";
$result = mysqli_query($link, $query);
while($row = $mysqli_fetch_assoc($link, $result)){
echo "<select name = 'category'>
<option value='".$row['category']."'>".$row['category']."</option>
</select>";
}
echo "Category: <input type='text' name='category'>";
?>
Image <input type='file' name='file'/>
<input type='submit' name='submit'>
</form>
Here I have assumed that you have a database table named 'image_gallery' in your database and you have a folder called 'uploads'. Go through the following link, it will give you some idea about file uploading.
http://www.w3schools.com/php/php_file_upload.asp
All the best.