开发者

Simple search form that redirects to ?s=searched terms

I want to make a simple form that redirects the user to "?=whateverhetypes". 开发者_JAVA技巧I'm sure it's easy but I just grasped the basics of sending variables through the url and I don't know how.

I suppose this would be the form:

<form>
<input type="text" name="search">
<input type="submit">
</form>

What's the shortest way to do it? Thakns


<form method="get" action="">
    <input type="text" name="s" />
    <input type="submit" />
</form>

Set action to be the URL of the file you would like the form to redirect to (for example action="/url/script.php"). Leave it blank to submit onto the current page.

Note how I renamed your text field to be just s so that when the form is submitted it will go to /url/script.php?s=searched terms like you have asked in the title of your question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜