I have an decent sized HTML form, on top of this is Javascript which can create many more 'records' to certain parts of the form. In total we could be talking 50+ INPUT elements.
I'm wondering of the best way to process all of this data by PHP:
Pass it as a normal INPUT elements via POST and let the PHP decode it all.
Or lose the names of the form input elements so they are not presented in the POST and then use Javascript on the submit event to encode all the required input elements into an object and then encode that object into JSON and pass via a single hidden input element.
I'm thinking the later would allow me to write clearer code on the PHP side, and it would basically be passed as an object once run through json_decode(), and would be more abstract from html changes. Whilst the former requires no javascript, but would need to be kept in sync with the html.
Or another method I've not thought of.
Which do you think would be the best way?