The method attribute in Html forms can either take GET or POST value. We will what each method does and when to use it
The GET method is when data is not protected when transmitted. This means the data which is sent is less protected and easily intercepted
The GET method is used mainly for search queries where the entered data is not sensitive or private
The GET method sends the data of form or a search query through the url. So it is visible and less protected
The GET method can only transmit a maximum of 2,048 characters
This is the default method used in Html forms
POST method makes sures that data is not visible or send through the url. This makes it more secure and reliable
The POST method is mainly used to transmit very sensitive data such as credit card details and passwords
POST method allows encryption of data making it more secure and less likely to be hacked
The POST method allows unlimited characters to be transmitted
It is better to always use POST for any kind of form except for search bars
The POST method can tranmit more data than GET
The GET method is less secure than POST
POST allows encryption - enctype
GET method executes much faster and through urls
We will look at some more attributes which are used in HTML forms
These attributes are not neccessary but is needed for certain situations
formaction - used to send the form details to a different PHP file from which was defined by the action attribute in forms
formenctype - change the encoding type used
formnovalidate - doesn't require to validate the form
formmethod - change the method
We will see the how to apply them in HTML codes
RunThis topic is mainly focused on Javascripting and PHP but, even HTML has some attributes which can be used to validate the data entered
min - used for number input types where it defines the lowest possible number which can be entered
min - used for number input types where it defines the highest possible number which can be entered
autofocus - makes sure the input field is automatically highlighted when the page is loaded
placeholder - used to hint the user what kind of data to be entered
value - defines the default value to be accepted if no data was entered. The value attribute of an input tag holds the data entered and this is the attribute which the PHP files uses to read the data
name - this attribute is required for every input tag or else data will not be transmitted. This acts the variable name of the value that is entered
pattern - defines a pattern for how data should be entered. Look up Regex!
Step - used for number inputs where the number entered must be a multiple of the step value
multiple - allows multiple values, used for file inputs and select elements
More will be discussed under Javascript and PHP