WordPress.org

Ready to get started?Download WordPress

Forums

Search box (8 posts)

  1. Jabbok
    Member
    Posted 9 years ago #

    How do you put the word "search" in the search box instead of a seperate button beside or below the search box?

  2. Kafkaesqui

    Posted 9 years ago #

    Change the search input to:

    <input type="text" name="s" id="s" size="15" value="Search" />

    More interesting method:

    <input type="text" name="s" id="s" size="15" onfocus="this.value=''" value="<?php if (!$s) { $s = "Search"; } echo $s; ?>" />

  3. maestro42
    Member
    Posted 9 years ago #

    cool idea!

  4. Jabbok
    Member
    Posted 9 years ago #

    Thank you, that worked!

  5. davincim
    Member
    Posted 9 years ago #

    Kafkaesqui,

    I use Kubrick's search form. It says:

    <form method="get" id="searchform" action="<?php echo $PHP_SELF; ?>">
    <input type="text" value="<?=htmlentities($s); ?>" name="s" id="s" />
    <input type="submit" id="searchsubmit" name="Submit" value="<?php _e('Go!'); ?>" />
    </form>

    So I know I can make the first suggestion you made and place it in the first line of code here, but I don't know enough about forms yet to know how to remove the "go" button without screwing things up. I see the php_e('Go!), and I figure that's where I need to make a change, but need a little more help if you please. :)

  6. pezastic
    Member
    Posted 9 years ago #

    Just remove:
    <input type="submit" id="searchsubmit" name="Submit" value="<?php _e("Go!"); ?>" />
    That's the "go" button.

  7. Kafkaesqui

    Posted 9 years ago #

    Let me understand: you don't want a submit button with your search form? If that's the case, you can remove the whole <input type="submit" ... line, so that you're left with:

    <form method="get" id="searchform" action="<?php echo $PHP_SELF; ?>">
    <input type="text" value="<?=htmlentities($s); ?>" name="s" id="s" />
    </form>

    It's important to note that one would then need to hit the Enter key on their keyboard to submit a search, and not everyone is going to figure that out.

  8. davincim
    Member
    Posted 9 years ago #

    Thanks pezastic and Kafkaesqui.

    ...and not everyone is going to figure that out.

    I agree. On second thought, with the audience I'm targeting with my blog, they may think it's an error. But now I know a little more about the form code. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.