I have a form (of course) - its built into a table because the user can click a button and add more rows (then fill in more data) - the main issue is the user can remove rows (on the fly) and I want to make the able to move rows up and down (all done with JS)

fields are
item_x
itemdesc_x
qty_x
price_x
total_x

the x = a number...
so it could have item_1, item_2, item_3 - but also could have item_1, item_7, item_8 (because they can delete)

right now, with php I am looping 1 to 10000 and checking if item_X is set then insert into the db. works but its not a good way.


PHP Code:
$x 1;
        while (
$x 10000) {
            if (isset(
$_POST['item_' $x])){ 
I know.. BAD BAD BAD (its temporary to make it work)

How can I loop thought these in the correct order? do they come through the post in top down order? so I might get
item_7, item_3, item_4, item_9 (if thats how the user arranged them)

does this make sense? LOL