I have a search form in my website which is located in my header.php and I want it to be shown in all of my pages for this reason I have a searchform.php file where I have inserted this code:

<div class="search">
<form method="get" action="<?php bloginfo('url'); ?>/">
<input type="text" name="" placeholder="Search here..."onfocus="this.placeholder = ''" onBlur="this.placeholder='Search here...'"/>
</form>
<img src="<?php bloginfo('template_url');?>/images/search-icon.png" alt="search-icon"> 
</div>

And in my header.php I have added this piece of code:

<?php get_search_form(); ?>

On the other hand I’ve put this code inside my search.php file:

<p>You searched for " <?php echo esc_html( get_search_query( false ) ); ?> ". Here are the results:</p>

Now when I search for something I get no results. What is the problem? please help me.

Read more here: Search form does not work in my website


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: