I knew this was going to happen!
My form captures data and uploads an image into a folder and then the path is stored into a database table. In both cases a session is used to link this data to the user.
User creates form – username session stored in db table User uploads image – username session stored in db table
HOWEVER a user can upload any number of images so these records are not unique. A user could upload 10 images and only one form but each form MUST be linked to a single image! How do I ensure each form and image are linked to each other because unless I’m missing something there is no way to upload an image and then create a form at the same time? These are two independent actions? When you upload an image it’s stored in a temp folder and only once you click submit is the data then written into the table then clicking another submit button writes the form data into a table.
To make each record unique I could use an auto incrementing id field then store that in a session and write it to the two database tables but again I don’t understand how to ensure the form and image are linked?
I’ll post a gist once I understand the theory. This should help :
Sorry don’t know how to embed images :