Add information about HTML form submit (#32150)
-when to use HTTP GET -default for blank attribute <!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. --> - [X] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md). - [X] My pull request has a descriptive title (not a vague title like `Update index.md`) - [X] My pull request targets the `master` branch of freeCodeCamp. - [X] None of my changes are plagiarized from another source without proper attribution. - [X] My article does not contain shortened URLs or affiliate links.
This commit is contained in:
@ -88,17 +88,19 @@ A form will take input from the site visitor and then will post it to a back-end
|
|||||||
The HTML `<form>` tag is used to create an HTML form and it has the following syntax −
|
The HTML `<form>` tag is used to create an HTML form and it has the following syntax −
|
||||||
|
|
||||||
``` html
|
``` html
|
||||||
<form action = "Script URL" method = "POST">
|
<form action="Script URL" method="POST">
|
||||||
form elements like input, textarea etc.
|
form elements like input, textarea etc.
|
||||||
</form>
|
</form>
|
||||||
<form action = "Script URL" method = "GET">
|
|
||||||
form elements like input, textarea etc.
|
<form action="Script URL" method="GET">
|
||||||
</form>
|
form elements like input, textarea etc.
|
||||||
|
</form>
|
||||||
```
|
```
|
||||||
|
|
||||||
If the form method is not defined then it will default to "GET".
|
If the form method is not defined then it will default to "GET".
|
||||||
|
If you want to submit sensitive or large amounts of data you should prefer HTTP "POST" over "GET", since form data is visible in the URL when using "GET".
|
||||||
|
|
||||||
The form tag can also have an attribute named "target" which specifies where the link will open. It can open in the browser tab, a frame, or in the current window.
|
The form tag can also have an attribute named "target" which specifies where the link will open. It can open in the browser tab, a frame, or in the current window. If the target is not defined, the target URL will open in the current tab by default.
|
||||||
|
|
||||||
The action attribute defines the action to be performed when the form is submitted.
|
The action attribute defines the action to be performed when the form is submitted.
|
||||||
Normally, the form data is sent to a web page at the Script URL when the user clicks on the submit button. If the action attribute is omitted, the action is set to the current page.
|
Normally, the form data is sent to a web page at the Script URL when the user clicks on the submit button. If the action attribute is omitted, the action is set to the current page.
|
||||||
|
Reference in New Issue
Block a user