Jump to content

sorting elements with serialization sending array values


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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.