Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:03:18+00:00 2026-06-17T02:03:18+00:00

Ok this one should be fairly simple but Im finding it very hard. I

  • 0

Ok this one should be fairly simple but Im finding it very hard. I have found a great sortable example on http://www.xmech.net/programming/jquery-ui-sortable-tutorial/ which uses the jquery ui to sort a list and save it to the database.

Mine allows you to drag and drop but is not saving to the database. here is my jquery function

  <script type="text/javascript"> 
 $(document).ready(function(){
$("#menu-pages").sortable({
update: function(event, ui) {
    $.post("sortable.php", {type: "orderPages", pages: $('#menu-  pages').sortable('serialize') });
}
 });
 });
 </script>

and my php / html

   <ul class="menu" id="menu-pages">
   <?php
   mysql_select_db($database_dbconnet, $dbconnet);
    $resultq = mysql_query("SELECT * FROM `section` ORDER BY `sectorder` ASC", $dbconnet) or die(mysql_error());

   while($row = mysql_fetch_array($resultq)){
    printf('<li id="page_%s">%s</li>', $row['idsect'], $row['sectname']);
}
   ?>

  </ul>

and my php file called sortable.php

   require('../../../Connections/dbconnet.php');
   parse_str($_POST['pages'], $pageOrder);
    foreach ($pageOrder['pages'] as $key => $value) {
mysql_select_db($database_dbconnet, $dbconnet);
     mysql_query("UPDATE `section` SET `sectorder` = '$key' WHERE `idsect` = '$value'",     $dbconnet) or die(mysql_error());
  }

as you can see I have even tried to keep the same names as the example but I cant make it go.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:03:19+00:00Added an answer on June 17, 2026 at 2:03 am

    In looking at your jQuery, it seems you are posting JSON. I am guessing that $_POST is not being populated, because it only gets populated automatically for posts received in an form-encoded format. You need to read PHP raw input to get the JSON string and then you need to decode that JSON string into an object. That would be something like this:

    $json = file_get_content('php://input');
    $object = json_decode($json);
    $type = $object->type;
    $pages = $object->pages;
    

    You should always at least do some basic debugging attempts before posting a question, as I imagine the fact the $_POST is empty would at least have enabled you to focus your question on the issue at hand (i.e. this has nothing to do with either sortable or the database).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be fairly simple but I'm having one of those days. Can anyone
This should be a simple one: I have an observableArray object called To in
This should be a simple one and I am dissapointed with myself but cant
This should be a simple one, but I'm a beginner with C#. Given a
This seems like it should be fairly simple, but for some reason I can't
This seems like it should be something fairly simple, but I just can't seem
I imagine this is fairly simple and one I should be able to get
I have what should be a fairly simple ASP.NET question, and one I thought
This should be fairly simple, but I seem to be missing something. I'm working
This may not be the kind of question one should ask on StackOverflow, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.