SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Grab and replace (exchange) value

    Based on this example:
    Dynamic Drag’n Drop With jQuery And PHP
    http://www.webresourcesdepot.com/dyn...query-and-php/
    I tried to make a replacement football players in the right manager

    in link belowe:
    http://www.sportskevesti.co/component/m ... /index.php

    this is what i can do (sort). and this is something, but not good enough. Can someone help me how to this technique(jquery) make a real change of players(substitution) instead of sorting, (example in upper link)

  2. #2
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (this is my first java attempts on this example)

    I try to make online sooccer manager, and for that, i mast make soccer player substitution.
    Becose of that, i search for Drag and Drop rutine, and i find this example:

    Dynamic Drag’n Drop With jQuery And PHP:

    The JavaScript:
    <script type="text/javascript">
    $(document).ready(function(){

    $(function() {
    $("#contentLeft ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
    var order = $(this).sortable("serialize") + '&action=updateRecordsListings';
    $.post("updateDB.php", order, function(theResponse){
    $("#contentRight").html(theResponse);
    });
    }
    });
    });

    });
    </script>
    PHP part of code:
    <?php
    require("db.php");

    $action = $_POST['action'];
    $updateRecordsArray = $_POST['recordsArray'];

    if ($action == "updateRecordsListings"){

    $listingCounter = 1;
    foreach ($updateRecordsArray as $recordIDValue) {

    $query = "UPDATE records SET recordListingID = " . $listingCounter . " WHERE recordID = " . $recordIDValue;
    mysql_query($query) or die('Error, insert query failed');
    $listingCounter = $listingCounter + 1;
    }

    echo '<pre>';
    print_r($updateRecordsArray);
    echo '</pre>';
    echo 'If you refresh the page, you will see that records will stay just as you modified.';
    }
    ?>

    This is drag, drop sortable example

    And I need to do an example in which I will replace the players and not move one below the other.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •