Given the Following List (UL), how can it be serialized and sent to the Database
Posted
by nobosh
on Stack Overflow
See other posts from Stack Overflow
or by nobosh
Published on 2010-05-20T03:06:49Z
Indexed on
2010/05/20
3:10 UTC
Read the original article
Hit count: 243
I have the follow structure which is created with a nested sortable:
<UL id="container">
<LI id="main1">
<input type="checkbox" />
Lorem ipsum dolor sit amet, consectetur
<UL>
<LI id="child2">
<input type="checkbox" />
In hac habitasse platea dictumst.
<UL></UL>
</LI>
</UL>
</LI>
<LI id="main3">
<input type="checkbox" />
In hac habitasse platea dictumst.
<UL></UL>
</LI>
<LI id="main4">
<input type="checkbox" />
In hac habitasse platea dictumst.
<UL></UL>
</LI>
<LI id="main5">
<input type="checkbox" />
In hac habitasse platea dictumst.
<UL></UL>
</LI>
</UL>
Where I'm stuck is how to send this back to the database. I"m guessing that it needs to be serialized, does that sound right to?
so that is looks something like:
item[]=main1&item[]=221&item_221[]=21&item_221[]=2&item_221[]=211&item[]=22
I'm a little lost at this point and appreciate any tips to move me in the right direction.
Thanks,
B
© Stack Overflow or respective owner