The form tag in the preceding code snippet does not include a method attribute. The method attribute
tells the browser whether to use an HTTP POST or HTTP GET when sending the information.
You might think the default method for a form is HTTP POST. After all, you regularly POST forms
to update your profi le, submit a credit card purchase, and leave comments on the funny animal
videos on YouTube. However, the default method value is “get,” so by default a form sends an
HTTP GET request:
1
2
3
4 | <form action="http://www.bing.com/search" method="get">
<input name="q" type="text" />
<input type="submit" value="Search!" />
</form>
|
When a user submits a form using an HTTP GET request, the browser takes the input names and
values inside the form and puts them in the query string. In other words, the preceding form would
send the browser to the following URL (assuming the user is searching for love): http://www.bing.
com/search?q=love.
Yorumlar
Yorum Gönder