Parsing array
Posted: Wed Mar 10, 2010 3:15 pm
Hello,
Having a bit of trouble trying to figure out how I can iterate through an array in PHP to update the database. I am getting a string with all the elements serialized from jquery ui using the .sortable. This is a nested list made of UL/LI tags. Here is an example: http://www.b-hind.eu/jquery/index.php
The array comes out as a serialized string... (formatted below to make it easier to read)
listItem[]=472
&listItem_472[]=478
&listItem[]=479
&listItem[]=480
&listItem[]=481
&listItem[]=469
&listItem[]=445
&listItem[]=468
&listItem[]=477
This is what I need to to translate as.
0=472
472=478
0=479
0=480
0=481
0=469
0=445
0=468
0=477
The left number indicates parentid. The right number indicates the childid. "0" is the root level.
Any help much appreciated.
Having a bit of trouble trying to figure out how I can iterate through an array in PHP to update the database. I am getting a string with all the elements serialized from jquery ui using the .sortable. This is a nested list made of UL/LI tags. Here is an example: http://www.b-hind.eu/jquery/index.php
The array comes out as a serialized string... (formatted below to make it easier to read)
listItem[]=472
&listItem_472[]=478
&listItem[]=479
&listItem[]=480
&listItem[]=481
&listItem[]=469
&listItem[]=445
&listItem[]=468
&listItem[]=477
This is what I need to to translate as.
0=472
472=478
0=479
0=480
0=481
0=469
0=445
0=468
0=477
The left number indicates parentid. The right number indicates the childid. "0" is the root level.
Any help much appreciated.