Passing Search variable in Hyperlink
Passing Search variable in Hyperlink
Is it possible to pass a Search variable in a hyperlink?
For example: ?search=foo. I'm creating a table with php/mysql. I can $foo = $_GET['foo'] so I have the users search string. But now how do I get $foo into the search box?
Ideally I want 'foo' to show up in the Search form box affecting the search, but also allow the user to search the entire table with 'bar'. I could change the Query on the page, but that would not allow the users to do a Search for something other than foo at the page.
PS: I found the note about server-side function (http://datatables.net/examples/server_side/custom_vars.html). But I'm having trouble understanding from this how to manipulate the search variable.
Thanks,
Gerry
For example: ?search=foo. I'm creating a table with php/mysql. I can $foo = $_GET['foo'] so I have the users search string. But now how do I get $foo into the search box?
Ideally I want 'foo' to show up in the Search form box affecting the search, but also allow the user to search the entire table with 'bar'. I could change the Query on the page, but that would not allow the users to do a Search for something other than foo at the page.
PS: I found the note about server-side function (http://datatables.net/examples/server_side/custom_vars.html). But I'm having trouble understanding from this how to manipulate the search variable.
Thanks,
Gerry
This discussion has been closed.
Replies
[code]
$(document).ready( function() {
$('#example').dataTable( {
"oSearch": {"sSearch": "<?=$_GET['foo'];?>"}
} );
} )
[/code]
http://datatables.net/usage/options#oSearch
Allan
"oSearch": { "sSearch": "<?php echo $_GET['foo']; ?>" },
Thank you!
This worked phenomenally well!
Thank you!