开发者

send time posting this...custom search form....need help please

I have a search form i made for a wordpress site.....visually it is good but still not functional.....please let me know what im missing here.

<body>
<form id="start" action="/">
    <h1>Search our site</h1>
<p>
        <label for="name">Entry</label>
        <input type="text" id="name" size="35" />
    </p>
    <p>&nbsp;</p>

    </p-->
<p>
  <label>
  <input type="checkbox" name="posts" id="posts" />
  posts</label>
  <label>
  <input type="checkbox" name="pages" id="pages" />
  pages</label>
  <a class="submit" href="#">Submit</a></p>

</form>
<p i开发者_Go百科d="credits">&nbsp;</p>
</body>


You need to provide a way to submit the form.

<a class="submit" href="#" onclick="document.getElementById('start').submit()">Submit</a>


Based on the comments, we now know what you are trying to do. Your original question was not very specific.

In addition to the missing submit button, you also need to make sure you pass the correct variables in your form to the Wordpress search function. In your example:

    <label for="name">Entry</label>
    <input type="text" id="name" size="35" />

This code will handle the user input for the search term, I assume. The second line, the input element, needs a name like so:

    <label for="name">Entry</label>
    <input type="text" id="name" size="35" name="s" />

When this is submitted you will see the s=foo in the URL and that will tell Wordpress that it is doing a search.

I found this out by looking at the source code for a default wordpress search form. I'm not sure what the variables are needed for the other aspects of the form, "posts" and "pages", but you can examine a standard wordpress search form (maybe advanced search?) and then name your form elements appropriately.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜