Anyone can help me understand how forms are coded in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Anyone can help me understand how forms are coded in html?

HTML question: forms

20th Jun 2017, 9:43 PM
Dana Belally
6 Answers
+ 6
html forms comprises 4 main components: form tag, label, input and a submit button. i.e <form> <label></label> <input> <button></button> </form> that's the basic skeleton of forms. But to make it really work as a form you need to add attributes and values to the tags. I will leave that to your exploration. Happy coding...
20th Jun 2017, 11:07 PM
Benneth Yankey
Benneth Yankey - avatar
+ 4
You got the action method right.👍 But "GET" & "POST' are http headers. They tell the browser how to handle the form information sent over to server either locally or not.
21st Jun 2017, 11:09 AM
Benneth Yankey
Benneth Yankey - avatar
+ 2
The method attribute tells how the browser handles the form information. Mostly two important values for the method attribute "GET" or "POST". The action attribute points the url where the form is sent to be further processed. eg. action = "./formHandler.php", assuming the php file is in the same root location as the html file. For a real or same production form, you can't achieve anything meaningful without using the method and action attributes.
21st Jun 2017, 10:54 AM
Benneth Yankey
Benneth Yankey - avatar
+ 1
@benBright thanks for your answer, but let me rephrase my question: how are the method and action utilized ? I made a form with and without them and i had the same result so
21st Jun 2017, 10:45 AM
Dana Belally
+ 1
@benbright what do get and post mean? I mean what is their function ? and concerning action, it is not where the user is directed; it's where the collected data is sent when submitted, right ? (sorry for asking too much )
21st Jun 2017, 10:57 AM
Dana Belally
0
Thank you so much for your time ! much appreciated💕
21st Jun 2017, 11:14 AM
Dana Belally