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 6733627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:47:31+00:00 2026-05-26T10:47:31+00:00

I am having a problem that I cannot figure out. I am using the

  • 0

I am having a problem that I cannot figure out.

I am using the tableDND jQuery add in, which allows me to drag and drop rows of a table. I want to send those rows to the server and have them uploaded to a mySQL database.

My code is below, basically when I get to the PHP the first element of the batting variable is gone. Any ideas?

So I have the following javascript:

$('#order').tableDnD({
        onDrop: function(table, row) {

            var batting = $.tableDnD.serialize();
            var id = <?php echo $id;?>;

            $.ajax({
                type: 'POST',
                url: 'update_batting.php',
                data: '{ "batting":' + batting + ', "id":'+ id +' }',
                dataType: 'json',
            });

        }
    });

and the following php:

<?php

$batting = json_encode($_POST['order']);

$query = "INSERT INTO test (t) VALUES ('$batting')";
mysql_query($query);

?>
  • 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-05-26T10:47:32+00:00Added an answer on May 26, 2026 at 10:47 am

    Ok so this is my crude guess at this one since I have to go soon…

    I think since “data” is converted to a query string it is being misread.
    I think your post is probably reading this:

    $_POST['batting'] = 'order[]=110209';
    $_POST['order'] = 'order[]=100245&order[]=100007&order[]=100296&order[]=10‌​0213&order[]=100071&order[]=100125&order[]=110206&order[]=110205&order[]=100152&o‌​rder[]=100247&order[]=100329&order[]=100299&order[]=100243';
    $_POST['id'] = '662852670';
    

    Because the first occurrence of the ampersand is terminating your variable.

    It might seem silly, but you can probably escape this whole problem by surrounding “batting” with double quotes. Effectively containing it as a string.

    data: '{ "batting":"' + batting + '", "id":'+ id +' }',
    

    This would change your expected $_POST[‘order’] variable to “$_POST[‘batting’]
    However, your data object should be contained like I originally mentioned in the comment above.

    data: {order: '"' + batting + '"', id:id},
    

    Instead of sending it as a string with no key as in your sample code.

    Try var_dump($_POST) in php to see all values you’re getting… just out of curiosity.

    **Sorry for all the edits. I’m being distracted constantly at work…

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

Sidebar

Related Questions

I'm having a strange problem which I cannot figure out for the life of
I am having one hell of a problem that I cannot figure out for
I am having the problem that I cannot select a specific XML node which
I am having a problem where a routine (that I cannot modify) is returning
I'm having a problem with wpf listbox. my problem is that when I add
One of my users is having this weird problem that I cannot seem to
I am having problem that when i am trying to submit the form by
HI Guys, Here I am having problem that How can I post an image
I am having a problem that just started happening in OS 3.1. I have
Essentially, after compiling utility jars w/ ANT, I'm having the problem that all the

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.