php - issue with search form -


im developping plugin have custom search page custom post, have create custom page this

<?php   /* template name: search-sa_notification */?>  <?php get_header(); ?>              <section class="mo-content">     <div class="row">         <div class="large-9 columns">             <form method="post" action="<?php echo $_server['php_self']; ?>">                 <br /><br /><br />                 <input class="form-control" type="text" placeholder="something" name="cernmb" /><br />                 <input class="button small yellow" type="submit" value="search" name="submit" />                 <input class="button small yellow" type="hidden" value="test" name="sbtn" />             </form>         </div>    </div>    </div> <?php      if(isset($_post['submit']) , $_post['sbtn']=='test'){         echo "ur number ".$_post['cernmb']."\n";     } ?> <?php get_footer(); ?> 

the problem im facing when click on search got redircted index page while me wanna stay in search page , display msg in test condition got redircted index page instead

it seems line problem:

<?php echo $_server['php_self']; ?> 

when put in different template files on wordpress site, echo's out path index.php. try making path template file instead.

if want form submitted same page, leave action attr blank:

<form method="post" action=""> 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -