I'm trying to create a general search page. I've created a search page template and a new search page, and set the form's action to the URL of this page.
When I access the search page directly it fetches the right template, but when I try to send a form to this URL, be it via $_GET or $_POST, I am directed to the default index.php template.
Form code:
<form action="<?php echo get_permalink(359); ?>" method="GET">
<input name="s" type="text" id="search_box">
<input type="submit" value="submit" style="visibility:hidden;">
</form>
Search page code:
<?php // Template Name: חיפוש
get_header(); ?>
<div id="search_page">
<?php
$search = new WP_Query(array('s'=>$_GET['s']));
if ($search->have_posts() ) : while ( $search->have_posts() ) : $search->the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt();
endwhile; ?>
<!-- post navigation -->
<?php else: ?>
<!-- no posts found -->
<?php endif; ?>
?>
</div><!--search_page-->
<?php
get_footer();
s
. I think you are getting a conflict with the default search.