title: Save sort order to hidden field with sortable jQuery plugin
body: <p>I am using this plugin (<a href="http://farhadi.ir/projects/html5sortable/" rel="nofollow">http://farhadi.ir/projects/html5sortable/</a>) to create a feature for a website where a user can add form fields on the fly.</p>
  
  <p>The idea is that they will give the form a name (title), and then add a series for form fields. These form fields need to be drag and drop sortable (thus the plugin) so the user can rearrange the order.</p>
  
  <p>Once they are satisfied with the order, they will click the "Create Form" button, and the data to create the form will be submitted.</p>
  
  <p>The data itself will be stored in three tables. Table 1: Forms, Table 2: Fields, and Table 3: Forms_Has_fields. The Forms_Has_fields table will includes a sort_order column, which tells the system in what order to display the fields.</p>
  
  <p>That's where this question is important: when a field is re-sorted using the drag and drop feature, I need a way to save the sort order in an  or some other form control so I can parse it with PHP and create the fields properly.</p>
  
  <p>If this was in PHP, I would just keep everything in an associative array: ($fieldname => $sortorder), but that doesn't seem like it's an option in javascript. Ideally, I could keep this in an array in Javascript, and then when sumit was clicked, dump that array as a JSON to an  field, and POST it to PHP. But if that's possible, I don't know how to do it.</p>
  
  <p>If there is another (more elegant) way to handle this, I am open to suggestions.</p>