WordPress.org

Ready to get started?Download WordPress

Forums

search form adding extra (2 posts)

  1. boattraveller78
    Member
    Posted 2 years ago #

    Hi

    I have a widget for a custom search form on my website as the following (which definitely worked in 2010)

    <form method="get" id="search_form" action="<?php bloginfo('home'); ?>/">
    <p>Search for: <input type="text" class="search_input" value="searchstring"
    name="s" id="s" /></p>
    <input type="submit" id="searchsubmit" value="Search" />
    </form>

    The problem is that the URL I get is
    http://www.mydomain.com/<?s=searchstring

    which does not work because of the '<'

    http://www.mydomain.com/?s=searchstring

    works fine but I cannot figure out why the '<' is being added.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    :

    <form method="get" id="searchform" action="<?php echo home_url(); ?>">
    <div>
    <label for="s" class="offset"><?php _e('Keyword(s)');?></label> <input class="text" type="text" value=" " name="s" id="s" />
    <input type="submit" class="submit button" name="submit" value="<?php _e('Search');?>" />
    </div>
    </form>

Topic Closed

This topic has been closed to new replies.

About this Topic