Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    New York
    Thanked 0 Times in 0 Posts

    PHP & AJAX request

    This is driving me nuts...
    using the scriptalicious library to handle an ajax request, and the serialized array i'm passing to the php page (via POST) isn't being parsed properly by the foreach loop i have in place. It works perfectly on two testing environments, and on a different host, so i think i may just need to set a variable in my php,ini, but i can't figure it out...

    the javascript function i'm using on the first page is below:
    function updateOrder(){
    var options = {
    method : 'post',
    parameters : Sortable.serialize('item_list')

    new Ajax.Request('reorder.php', options);

    the php page:
    <? my connection string ?>
    foreach($_POST['item_list'] as $key=>$value) {
    $q_order = "UPDATE table SET the_order = ".$i." WHERE id =".$value;
    mysql_query($q_order, $db->query);

    Someone had suggested exploding what should be an array on the php page into an array itself (implying perhaps the posted value was being interpreted as a string instead of an array), but that didn't work.

    Any help or insight at all would be huge.
    Thanks in advance.

  • #2
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Thanked 9 Times in 9 Posts
    Upload a file to the problematic server called phpinfo.php with the following code:

    PHP Code:
    <?php phpinfo(); ?>
    Do a search on the resulting page for 'register_globals'. I'll bet it's set to 'Off'.

    Should this be the case, recode to declare your variables properly or upload a htaccess file with the following directive override:

    php_value register_globals 1
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.


    Posting Permissions

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