I am creating a very basic photo uploading site that will allow users to:
1) select a file to upload
2) choose an category from a drop down
3) tag the photo with names
Users will then be able to search using their name to find pictures.
Since there will be situations where the uploading user will want to tag multiple people who appear in a single photo, is there a simple way to allow them to type names separated by commas and then have PHP create unique entries in the database? If not, what’s the best procedure for having multiple text fields to accomplish this?
Thanks
chance
If I understand you, there are a couple of ways.
First, you can, as you’ve said, have a single text field, comma separated. In this case, the PHP after the form is submitted can simply explode the string by “,”.
Alternatively, you can have an array of input items using e.g. “inputName[]” as the input name. Once this is submitted, PHP will create it as an array of items which can be looped through.
Once that’s done, you do whatever you need to with the data.