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)
<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>"; }$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?