SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2011
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Search function not working

    I have the website free articles and i have added a cool search box in the middle but i don't know why, when i try to search something it doesn't work, it sends me to 404 not found, despite the fact i have tried exact titles from some articles on my website. The search box from the footer right works properly but the cool big one doesn't. Please help.
    HTML Code:
    <form id="searchbox"  method="get" action="<?php bloginfo('home'); ?>/" value="">
        <input id="search" type="text" placeholder="Type here">
        <input id="submit" type="submit" value="Search">
    </form>

  2. #2
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is because your search result doesnt go through at all

    http://www.articlespedia.org/%3C? is what i get when i search for 'test'

    try
    <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>

    which is the default search for wordpress

    that should pass the search over BUT i think you have also deleted you searchform.php file which is located in the root of your theme folder

    let me know...

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2011
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the observation mate. The final form of my search form is this:
    <form id="searchbox" method="get" action="http://www.articlespedia.org/" > <input type="text" value="Enter Search Terms" onfocus="if (this.value == 'Enter Search Terms') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Search Terms';}" size="18" maxlength="50" name="s" id="search" /> <input type="submit" value="search" id="submit" /> </form>
    and working well now. Searchform.php wasn't deleted.
    Thanks again


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •