Jump to content

sorting elements with serialization sending array values


vikela

Recommended Posts

i have the following code which i am trying to figure out how to retrieve the values and insert in a db.

its a code that would allow a user to sort elements and then commit the new arrangement onto the db.

one way i am told is to use the parse_str($_POST['data']).i can connect to my db withouth any problem.

 

 

<script type="text/javascript" src="../scripts/prototype.js"></script>
<script type="text/javascript" src="../scripts/scriptaculous.js"></script>

<script type="text/javascript">
   window.onload = function() {
       Sortable.create('events',{tag:'li'});
   }
   function serialize(container, name){
      $('display').innerHTML =
      'Serialization of ' + $(container).id + ' is: <br/><pre>' +
      Sortable.serialize( container,{ name:name} ) + '</pre>';
   }
</script>

<style type="text/css">
li { cursor: move; }

</style>
</head>
<body>

<p>Drag and drop list items to sort them out!</p>

<ul id="events">
   <li id="event_1">Event 1</li>
   <li id="event_2">Event 2</li>
   <li id="event_3">Event 3</li>
   <li id="event_4">Event 4</li>
   <li id="event_5">Event 5</li>
   <li id="event_6">Event 6</li>
</ul>


<button type="button" value="Click Me" 
           onclick="serialize('events', 'event')"> Serialize
</button>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.