iLTC Home
Bookmark iLTC!

Categories

Perl
  • Perl Tutorials Beginners

  • Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

  • HTML
  • HTML Tutorials

  • Command Line
  • Command Line Tutorials

  • How Tos
  • Other Tips and Tricks



  • <script type='text/javascript'>
    1727890

    iLoveTheCode.com

    HTML Forms

    HTML Forms and How to Make Them.

    For testing and better understanding:
    -Copy this form.
    -Paste into a text document.
    -Save the file as test.html
    -Open text.html in your browser.
    -Fill in the form and click the Submit Button.
    -Look at the Query String in your browser's Address field.
    ---The values from our form are on the query string and could be used in a javascript if we were so inclined.


    <form action=test.html method=get>

    <input type=text name=a>
    <input type=checkbox name=b>
    <input type=radio name=c>

    <select name=d>
    <option value=happy>HappY Times
    <option value=bored>Tired times
    </select>

    <textarea name=e></textarea>

    <input type=hidden name=f value="Chris Happy">
    <input type=password name=g>

    <input type=button value="Push Me">
    <input type=submit value="Submit Me">
    </form>

    NOTE: The names of our fields (a,b,c,d,e,f,g) can be anything we want them to be.

    FORM TAG
    -Our first line is our opening form tag. It contains two pieces of information. The action and the method
    ---The action is basically the URL we want this form to submit to. Many times it is to a CGI script. In our example we will submit to the same page we are on.
    ---The method can be GET or POST. POST would most often be used when the form is to be submitted to a Perl or PHP script. GET can be useful for HTML pages that will contain Javascript. Since we don't have a Perl script here, we will use GET. GET puts the form values on the query string.

    TEXT FIELD
    -Our first input is a text field. Users can type text in it. We can define it further with 2 properties.
    ---<input type=text name=a size=15 maxlength=25>
    ---NOTE: maxlength can be beaten, don't depend on it for security.
    ---We could also make our field "read only" like so: <input type=text name=a readonly> Again, this can be beaten by the user so don't depend on it for security.

    CHECKBOX
    -Our second input is a checkbox. If selected, it will have the value of "on".

    RADIO BUTTON
    -Our third input is a radio button. If selected, it will have the value of "on".

    SELECT MENU
    -Our fourth is a select menu. We named our menu in the select tag.
    ---Each option gets its own value.
    ---Can be defined further with size property. <select name=d size=5>

    TEXTAREA
    -Our fifth is a textarea. We can define it further with 2 properties.
    ---<textarea name=e cols=20 rows=5>

    HIDDEN
    -Our sixth is a hidden field.
    ---This is only for neatness. It is NOT secure since users can view this by looking at the source code.

    PASSWORD
    -Our seventh is a password field. Dots or asterisks will be placed when the user types in this field. This will prevent over-the-shoulder snooping, but it is not secure. (If you tested at the beginning, you might have noticed that the password was passed unhidden on the query string.)

    BUTTONS
    -Our last two elements are buttons.
    ---The first is just a button. It can be used with onClick Javascript to make things happen.
    ---The second is a submit button, which as its name states, will submit the form.


    Resources:
    Javascript Query String
    Javascript Tutorials
    HTML Tags
    Perl Tutorials
    HTML Tutorials
    onClick Javascript
    HTML Codes





    Previous Article: HTML Subscript Text
    Next Article: HTML Title Tag






    Search iLTC w/ Google




    Recent Articles

  • HTML Font Code
  • Javascript and CSS - Easy Pop Up Help Balloons
  • Use OnMouseOver in Javascript
  • Use onMouseOut in Javascript
  • Use innerHTML to Change Text on a Page
  • Renaming a File with Perl's RENAME Function
  • PRINT to Browser with document.write Command in Javascript
  • Passing an Argument or Variable to a Javascript
  • Opening an Alert Box in Javascript
  • Opening a REMOTE WINDOW in Javascript
  • OPEN and WRITE a Data File in Perl
  • OPEN and READ a Data File in Perl
  • Mimic Typing from a Textfield in a Textarea with Javascript
  • Javascript Reset Form








  • Perl Programming - Javascript Programming - HTML Code - Mac Unix Command Line - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006-2009 iLoveTheCode.com


    Contact Chris | About this Site


    1727615
    Counter by iLoveTheCode.com


    Last Modified: Saturday, 10-Jan-2009 05:40:24 EST



    Hosted as well :)
    Home-brewed logo - 1997