jquery not passing variables to next page

jquery not passing variables to next page

This code has evolved on SO but I'm having issues with the code not passing the variables to the next page.

I have a jquery code that listens for what "folder" the user chooses and then it is supposed to present the information in a div. I moved the ability to choose the folder from being a html select option box to being just links and now the information isn't showing. I believe that it's not passing the variables from the first page to the second page.  When I click on the links nothing appears in the div like it did when I had the folder names in a <select> box.


First page code: (jquery and the php to show the list of folders the user has created)





  1. <script type="text/javascript"> 
    $(document).ready(function () { 
    $(".folders").click(function() { 
    var option = $(this).val(); 
    var selectedUser = $("#thename").val(); 
    $.get("selectfolders.php", {select:option,username:selectedUser},function(data){ 
    $("#theresult").html(data).hide().fadeIn(1000); 
    }); 
    }); 
    }); 
    </script> 

    //The php for listing the folders 
    $thelistquery = mysql_query("SELECT * FROM folders WHERE username='$username'"); 
    while ($lrows = mysql_fetch_array($thelistquery)) { 
    $id = $lrows['ID']; 
    $foldername = $lrows['foldername']; 
    $newfoldername = mysql_real_escape_string($foldername); 
    echo "<a class='folders' value='$newfoldername'>$newfoldername</a>"; }

The variable "username" in the jquery code is from a <input type=hidden> value.  I didn't put it in here though.

Second Page Code: (Gets the variables and uses it to display information on the first page.)



  1. $username = $_GET['username']; 
    $theselect = $_GET['select']; 

    $thelistquery = mysql_query("SELECT * FROM folders WHERE username='$username'"); 
    while ($lrows = mysql_fetch_array($thelistquery)) { 
    $id = $lrows['ID']; 
    $foldername = $lrows['foldername']; 
    $newfoldername = mysql_real_escape_string($foldername); 
    if($_GET['select'] == "$newfoldername") { 
    //What to display 
    } 
    } 
    ?>


I don't know why it's not sending the select and username variables.  Can someone please guide me through this?