I do not actually know much about PHP and jQuery. I am a self-taught programmer, lately I've focused on web programming with PHP for the server-side and JavaScript for client-side.
AJAX is a relatively new concept for me, I'm just doing the first tests.
I'll explain my problem, surely what I want, it should be trivial to many.
I have a rather long form, it have checkboxes, text inputs, textareas and selects, further, I want to add the bootstrap file-input plugin to my form.
The problem is that I want to send all the data together, and I can’t send the photos before and after send the data, or send the data and then send the photos.
The reason for this is that my database is relational, and I need to associate the data and pictures to the same ID, which must be self-generated, is an autoincrement field.
Imagine I have a table called data and another table called data_ref_pictures And in my form there are only these fields name, gender and age:
data(id, name, gender, age)
data_ref_pictures(id_data, picture_path)
I am very concerned because I think my system is mono-user/single-user :-(
Imagine that there are 100 users in different places, and they all at once are using the form, suppose now that the form is already filled and that the photos are selected too (without sending anything yet), the form is ready to send, and all 100 users simultaneously press the submit button.
How can I know the id number of the data, in order to avoid that the system makes any mistakes and mix the data and pictures of users.
The problem is that I don’t know to associate all data and pictures sent by the user with a unique autoincrement id.
Thanks for reading!