php - Best way to submit UL via POST? -


Quick question ...

I have an input box that is entered on the key, Adds a value to it in an anord catalog How will I pass this unordered list to jquery post? I am using form.serialize, so I do not need to define each variable for posting.

For example, suppose I have entered 3 fruits and they dynamically add them to an unordered list within the form.

Ul>

I was thinking of creating a hidden text field that is populated with

code> & lt; Ul & gt; & Lt; Li & gt; Apple & lt; Input type = 'hidden' name = 'fruit []' value = 'apple \' /> & Lt; / Li & gt; & Lt; Li & gt; Pear & lt; Input type = 'hidden' name = 'fruit []' value = 'pear' /> & Lt; / Li & gt; & Lt; Li & gt; Banana & lt; Input type = 'hidden' name = 'fruit []' value = 'banana' / & gt; & Lt; / Li & gt; & Lt; / Ul & gt;

On submission, you will find an array containing those values ​​in $ _ POST named fruit .


Comments