Thursday, December 20, 2012

Introduction to HTML form

I am making a series of videos for  web development, which are in my youtube channel.
Introduction to use form, radio, checkbox, select, option text, password, textarea, hidden, file, submit, reset in HTML form.

Example of HTML form:
   <title>HTML form</title>
    <h1>HTML form</h1>
<form id="form1" name="form1" method="post" action="test.php">
  User Name: <input type="text" name="name"   size="20" /> <br>
  Password: <input  type="password" name="psd" size="20"><br>
  <input type="submit" name="Submit" value="submit" />
  <input type="reset" name="Submit2" value="reset" />

radio type: used checked to mark default, you can only make one choice
 Gender<input type="radio" name="gender" value="male" checked> male
        <input   type="radio" name="gender"  value="female">female

checkbox: : used checked to mark default, you can only make multiple choice
 Hobby<input type="checkbox" name="ah1" value="swim"> swim
<input type="checkbox" name="ah2" value="hiking">hiking
<input type="checkbox" name="ah3" value="basketball">basketball
<input type="checkbox" name="ah4" value="hockey" checked>hockey

select from list: used selected as default
 Country<select name="jg">
              <option value="Canada" >Canada</option>
            <option value="USA">USA</option>
            <option value="China">China</option>
            <option value="Korea">Korea</option>
            <option value="Japan" selected >Japan</option>

textarea: for long text
 <textarea name="bz" cols="30" rows="3" ></textarea>
hidden: will not shown, but the value will be assigned to the name when the form is submitted
 <input  type="hidden" name="x"  value="20" > 
file: upload a file, a file will be selected from your computer:
Upload<input type="file" name="upload" />
The video for this demo

No comments:

Post a Comment