|
|
#1 (permalink) | ||||||||
|
Senior Member
Join Date: Jan 2007
Posts: 118
|
This tutorial is for those without a whole lot of knowledge about HTML.
Ever wanted to know how to add user input to your web pages? It's not that hard. The key to doing this is the <form> tag. Forms are just a bunch of input methods grouped together (radio boxes, check boxes, text fields) <form> tags open and close your form. They define the properties of the form and surround the input methods. To create a new form, simply use the <form> tag. e.g. Quote:
There are three types of input fields: check boxes, text boxes, and radio buttons. To create any of them, just replace InputTypeHere in the above example with checkbox, text, or radio, respectively. Now you can create a form with input fields. The question is, how do we submit the data? Well, using a submit button! We can do this with the following line: <input type="submit" name="Submit!"> Just add that in before you close your <form> tag. There's one more thing we have to do. We have to edit our form tag. As of now, the submit button doesn't have anywhere to submit the data to. So, let's revise our form tag: Quote:
Using everything posted above, let's create a sample form: Quote:
There's another form of input that you may find yourself using. It's a drop down list, and I'm sure you've all seen it before. Lists are slightly more complicated, but still easy to create. To create a list, you use the <select> tag along with the name atribute. So, if we wanted to create a list titled Month, you would do the following: Quote:
Quote:
Quote:
There's one final thing I'm going to cover in this tutorial, and that's a text-area. One line text boxes are all very well, but if you're going to create something like a forum, guestbook, or anywhere where the user needs to be able to type something lengthy, you use the <textarea> tag. By using the rows and cols attributes, we can define a text-area: Quote:
By the way, if you want to, you can use text-areas outside of form tags. However, if you're going to have the text-area contain user input, you need to specify a name for it using the name attribute. The last attribute I'll mention is the readonly attribute, which you can use to specify that the textarea may not be modified. You do this by adding readonly="readonly" to your tag. Quote:
My first article. Hope you liked it, and sorry that it was long-winded! |
||||||||
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Jan 2007
Posts: 141
|
Articles not bad bro, I actually liked it. Should help out some html novices, and many people have problems with this. Maybe you should use a little free webhost and make an example? Just a thought
|
|
|
|
|
|
#3 (permalink) |
|
Senior Member
Join Date: Jan 2007
Posts: 118
|
Thanks. I think creating online, working examples is a good idea. Do you know of any free webhosts that support forms? I tried freewebs and they don't allow forms.
By the way, I had a major edit and doubled the length or so. Sorry if anyone thinks it's too long. |
|
|
|
|
|
#4 (permalink) | |
|
Senior Member
Join Date: Jan 2007
Posts: 447
|
Quote:
Thx for the Tutorials |
|
|
|
|