rgzamith
Member
Posted 2 years ago #
After a long searching, I've found this code to make a search box by category, that I'm going to put at the side bar as a text:
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>" />
<div>
<input type="text" name="s" id="s" value="" />
<input type="hidden" name="cat" value="3" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
But after the first search, an error appeared at the screen and then I saw that the http://www.mysite.com:80/<s=searchingword&cat=3 but this :80 not suppose to be there.
How I'll fix it?? I'm putting the code at the right place?
Try using:
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>" />
rgzamith
Member
Posted 2 years ago #
Still not working esmi!
Showing this again: HTTP Error 400.0 - Bad Request
ASP.NET detected invalid characters in the URL.
What is your site url? The problem may lie there.
rgzamith
Member
Posted 2 years ago #
I discover my self, don't know how this thing was missing:
<div id="searchbox">
<form method="get" id="searchform" action="http://www.mysite.com/">
<div>
I'm not telling the site because it's blocked, so it doesn't make any difference.
But thank, now I'm going to write my other doubt, help there!!
You shouldn't hardcode your site's url into the search script. Use <?php bloginfo('url'); ?> instead and then correct any issues in your site url.