The search wordpress plugin I am using in Wordpress, (Relavenssi), enables the consumer to include quotes to search phrases to be able to look for phrases, for instance "search termInch.

Wouldso would I code it to ensure that once the user chooses an invisibleOrexamine box known as 'Exact Match', the quotes are instantly put into the search query instead of being added in to the search box through the user?

Any help greatly appreciated, S.

Search form code below:

                  <form action="<?php bloginfo('home'); ?>/" method="post">
                  <div class="search-icon">     
                      <label for="search" accesskey="4" class="hidden">Search the site</label>                 
                      <input type="text" name="s" id="search" value="Enter search term" onblur="this.value = this.value || this.defaultValue;" onfocus="this.value = '';" />                
                      <input type="submit" name="submit" value="GO" class="s-btn" />
                      <p><a href="#" id="search-anchor">Search Options</a></p>
                      <div class="option-slide">
                      <input type="radio" name="sentence" value="" checked="checked" /><label>All Words</label><br />                          
                      <input type="radio" name="sentence" value="???" /><label>Exact Match</label>  
                      </div>   
                  </div>
              </form>      

Edit: In line with the answer from @Tristar Website Design below, I've now added this php code below my search form, even though it does not work correctly. It echoes out ok but is not passing the query back. How do you pass/send the up-to-date search query to Wordpress?

                if(isset($_POST['s']) && $_POST['sentence'] == 'exact') {
                    $_POST['s'] = '"'.get_search_query().'"';
                    echo $_POST['s'];
                } else {
                    echo "2";
                }   

A few techniques with this I suppose.

  1. Use PHP making it prepend and append quotes towards the search value if exact match is chosen.
  2. Use Javascript making it prepend and append quotes within the area onclick, therefore the value that's sent has quotes put on it. I'd most likely do this javascript method!

Edit:

Maybe think about this jQuery method (This process assumes that jQuery continues to be loaded, i added my very own noConflict() variable) -

<script type="text/javascript">
    var $j = jQuery.noConflict();

    function addquo() {
    if($j('#s').val()) {
    var text = '"'+ $j('#s').val() +'"';
            $j('#s').val(text);
    }
    }

    function removequo() {
    if($j('#s').val()) {

    var txt = $j('#s').val();
            $j('#s').val(txt.replace(/"/g, ''));

    }
    }

</script>

<form action="/" id="searchform" method="get" role="search">
<div><label for="s" class="screen-reader-text">Search for:</label>
<input type="text" id="s" name="s" value="">
<input type="submit" value="Search" id="searchsubmit">
<input type="radio" name="sentence" value="" onclick="javascript:addquo();" /><label>All Words</label><br />
<input type="radio" name="sentence" value="???" checked="checked" onclick="javascript:removequo();" /><label>Exact Match</label>
</div>
</form>