• Resolved ppivec

    (@ppivec)


    I am trying to make this work but it will not get the variable from the dropdown. I can manually add text to $search_text but not from the $_POST. Any help is REALLY appreciated.

    The code:

    <form method="post" id="searchform" action="<?php bloginfo('url'); ?>/">
    				  <table width=100% border="0" align="center">
    				    <tr>
    				      <td><label>Select Genre/Type of Game</label>
    				        <br />
    				        <select name="genre">
    				          <option value="Music"> - </option>
    				          <option value="Action"  > Action </option>
    				          <option value="Adventure"  > Adventure </option>
    				          <option value="Arcade"  > Arcade </option>
    			            </select></td>
    			        </tr>
    	      </table>
    <?php $search_text = $_REQUEST["genre"]; ?>
    <input type="text" value="<?php echo $search_text; ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search now" />
    </form>

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ppivec

    (@ppivec)

    Update:
    I am presuming that the problem is passing a variable from javascript (the table) to php. Hence I have tried this…

    <script type='text/javascript'>
    <?php $search_text ?> = document.write(document.getElementById('genre').value ); <?php ;?>;
    </script>
    
    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    
    				  <table width=100% border="0" align="center">
    				    <tr>
    				      <td><label>Select Genre/Type of Game</label>
    				        <br />
    				        <select name="genre" id="genre" >
    				          <option value="Music"> - </option>
    				          <option value="Action"  > Action </option>
    				          <option value="Adventure"  > Adventure </option>
    				          <option value="Arcade"  > Arcade </option>
    			            </select></td></table>
    
    <input type="hidden" value="<?php echo $search_text; ?>" />
    
    <input type="submit" id="searchsubmit" value="Search the Engage catalog now" />
    </form>

    But sadly it does not work either.
    Any experts out there that could please help?
    Thanks in advance.

    Thread Starter ppivec

    (@ppivec)

    Sorted. The searchform (get_var) reads from “s”.
    Renamed dropdown control to “s” and deleted hidden input, and it works fine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with searchform php’ is closed to new replies.