Associating submitted data with image

For context: This topic was split from this one in HTML & CSS:-

But appears to be more a PHP question.