Jump to content

Getting the Selected values from Select lists on the same page


phpretarded

Recommended Posts

 

 

Hello

 

I have 3 select lists, and while I have always used another php page to process the results which I get with $_POST['whatever'] now it turns out that in order to do pagination of results I need to be able to get those selected values right where the Select lists are, and not in the php processing page. I don't know how to pick them up, because only upon clicking the Submit button are they sent and recovered by the $_POST (or get or request).

 

I am going to be using Datatables to paginate, but, as I see the code, it needs to have the selected values right on the Select Lists page as I said. This is the code. Look for the word Krakow. Well, that is where the selected value from the Selected list should be... Any ideas on how to paginate when you are getting results where the WHERE clause of your sql query is what you get from the Selected lists? I have paginated easily when I do a query without WHEREs.

 


<script language= language="JavaScript" type="text/javascript">
$(document).ready(function() {
$('#shops').dataTable( {
	"bProcessing": true,
	"bServerSide": true,
	"bJQueryUI": true,
	"sPaginationType": "full_numbers",
	"sAjaxSource": "datatables/php/server_processing_shops.php",
	"fnServerData": function ( sSource, aoData, fnCallback ) {
		/* Add some extra data to the sender */
		aoData.push( { "name": "town_shop", "value": "Krakow" } );  
		$.getJSON( sSource, aoData, function (json) { 
			/* Do whatever additional processing you want on the callback, then tell DataTables */
			fnCallback(json)
		} );
	}
} );
} );

</script>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.