Search box code problem

4 replies
I cant get this figured out?? I need my search box to create a specific url when submitted. How would I edit the code below so a search for 'steve jones' returns this URL: http://blogname.com/ticket-tag/steve-jones/

HTML Code:
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div><label class="screen-reader-text" for="s">Search for:</label>
        <input type="text" value="" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="Search" />
    </div>
</form>
#box #code #problem #search
  • Profile picture of the author dudeontheweb
    The data from your form needs to be converted into an URL by the page you are submitting to.

    <?php echo home_url( '/' ); ?>Are you using some kind of custom function? Because I'm not familiar with this function. And php.net says it doesn't exist.
    Signature

    Need a QR Code? Check out my QR Code Generator. It's FREE!

    {{ DiscussionBoard.errors[4305085].message }}
  • Profile picture of the author Harrison_Uhl
    The url format that you are requesting is not in standard cgi format. You can use JavaScript to take the data from the form, and change it to the format you want.

    Alternatively, you can program the server side app to take both your desired url format, AND a corresponding cgi style request. That way this would not require JavaScript running on the browser.

    (The cgi style url would look like: http://myDomain.com/myPhpScript.php?name=steve+jones

    Harrison
    {{ DiscussionBoard.errors[4308210].message }}
  • Profile picture of the author Mike Adams
    Thanks guys! I'll get to work.
    Signature
    P.S. If you found my post useful, please click the "Thanks" button below...
    {{ DiscussionBoard.errors[4310822].message }}
  • Profile picture of the author Jake Gray
    I'm not quite sure what you mean, but I'll go with what I got. Do you
    mean a pre-set value?
    {{ DiscussionBoard.errors[4311247].message }}

Trending Topics