Storing dynamically generated fields

Out of context: Reply #4

  • Started
  • Last post
  • 8 Responses
  • Samush0

    if the data needs to be searchable or the individual field contents will need to deleted exclusive of each other you'll want to store them in separate MySQL rows.

    you can use jQuery to clone the fields already on the page and the clones can be given a slightly different name to their parent.
    e.g.
    name="url-0" -- original field
    name="url-1" -- clone 1
    name="url-2" -- clone 2
    ...

    then in your server-side code that processes the form you need to loop through all the form fields and pull out the data from the ones whose 'name' (attribute from html POV) or 'key' (array key from server-side POV) begins with "url"

    hope that makes sense :-/

View thread