RIRedinPA Posted June 25, 2010 Share Posted June 25, 2010 I'm trying to do something seemingly pretty simple - take a user selection from a select element and save it to a database...the select element gets written dynamically, like this: ... $resultcode .= "</p><p class=\"livedate " . $bgcolor . "\">" . $duedate . "</p><p class=\"status\"><select class=\"changestatus\" name=\"status\" id=\"" . $id . "_ status\">"; for($y=0; $y<count($statuslist); $y++) { if ($status === $statuslist[$y]) { $resultcode .= "<option value=\"" . strtolower($statuslist[$y]) . "\" selected>" . $statuslist[$y] . "</option>"; } else { $resultcode .= "<option value=\"" . strtolower($statuslist[$y]) . "\">" . $statuslist[$y] . "</option>"; } } $resultcode .= "</select> ... I then use javascript running jquery to get the item id, save that to a session, get the value selected and using AJAX send it to a php page to upload to a db... Javascript: //change status $('.changestatus').live('change', function() { //get and store id var thisid = getid(this); //get status value var thisstatus = $('.changestatus').val(); //change active back to a checkbox $.ajax({ type: "POST", url: "lib/updatestatus.php", data: "thisstatus=" + thisstatus, success: function(data) { $('#mainbox').html(data); resizerows('tablerow'); } }); }); ... function getid(thisitem) { //get id # from id attr and store in session var thisidstr = thisitem.id.split("_"); var thisid = thisidstr[0]; $.ajax({ type: "POST", url: "lib/storeid.php", data: "theid=" + thisid, success: function(data){ //alert(data); } }); return thisid; } problem is I keep getting this error message: Query was empty Your request couldn't be procesed. Even if I strip the updatestatus.php page down to just this <?php session_start() ?> I get the same error message. I can't find where it's failing. Any one have an idea? Quote Link to comment Share on other sites More sharing options...
brianlange Posted June 25, 2010 Share Posted June 25, 2010 Does the php file run okay if you access it directly? Set default variables for the post variables so it'll run. Trying running the script without the function that sets the id to the session. Just grab the id and pass it to the php file. If this works its something with your session code. Try to keep simplifying the script until you find out what's breaking it. Quote Link to comment Share on other sites More sharing options...
RIRedinPA Posted June 28, 2010 Author Share Posted June 28, 2010 Solved it. The problem was programmer with his head up his butt. I never over wrote the original updatestatus.php file... duh... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.