When there is no value for parameter "s" , it redirects automatically to homepage. Instead of this , I want to show all the information from my custom sql query. how can i do this??
You can pass
s=%20 as your search string, but thats kinda hackish.
If what you are trying to achieve is to use your search.php template but with "controled" search results, consider using this:
<?php global $query_string; // fetch query string being used query_posts($query_string . '&posts_per_page=20') // add your terms to it. ?>
Create a custom search form and use
<input type="hidden" name="s" value="whatever" /> in it, of course along with your usual search form (at the least an
<input type="text" name="search" />).
$_GET['s'] will always be set. Remember to create a custom search page running your custom query (with
$_GET['search'] for the search terms), or you will find yourself always searching for the placeholder value you put in
You can see a live example of a solution similar to this at my site Allt du behöver (unfortunately in Swedish but I think you can figure out how it works anyways).