If I were you, I would redesign the table structure. You dont actually need different table for every category.
Create one table with one additional field so its like this:
Table: images
Fields: id, category_id, name, caption, img
Now add one table for categories:
table: categories:
fields: id, name
So its like this:
images
+----------+-------------------+------------------+----------------+----------+
| id | category_id | name | caption | img |
+----------+-------------------+------------------+----------------+----------+
| 1 | 1 | somepic.jpg | Somepic | DATA |
+----------+-------------------+------------------+----------------+----------+
| 2 | 2 | otherpic.gif | Otherpic | DATA |
+----------+-------------------+------------------+----------------+----------+
categories
+----------+------------+
| id | name |
+----------+------------+
| 1 | Cat 1 |
+----------+------------+
| 2 | Cat 2 |
+----------+------------+
Now its easy to add a select with categories rows as options to your form. (this is mysql using PDO)
$sql = "SELECT id,name FROM categories ORDER BY name";
echo '<select name="category">';
foreach ($conn->query($sql) as $row) {
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
echo '</select>';
BTW, are you sure you want to save your pictures straight to db? Its quite common to save the data to filesystem and add just path to database.