Tuesday, 30 July 2013

What is use of HTML Forms and how to create HTML form ?

HTML Forms are one of the main points of interaction between a user and a web site or Site owner.
HTML forms are used to pass data to a server.  HTML form's   input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.
A web form on a web page allows a user to enter data that is sent to a server for processing as per user requirement.

example:-


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
form {
   
    margin: 0 auto; width: 400px; padding: 20px 25px 15px;
     border: 1px solid #e5e5e5;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
     border-radius: 10px;font-family:Arial, Helvetica, sans-serif; font-size:14px;
     background-color:#f1f1f1;
}
form div + div {
    margin-top: 1em;
}
label {
  
    display: inline-block;
    width: 90px;
    text-align: right;
}
input, textarea {
   
    font: 1em sans-serif;font-size: 15px;
          width: 300px;
    height: 29px;
  margin: 0;
  padding: 0 8px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-top: 1px solid #c0c0c0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-border-radius: 1px;
  -moz-border-radius: 1px;
  border-radius: 1px;
}

input:hover, textarea:hover {border: 1px solid #b9b9b9;
  border-top: 1px solid #a0a0a0;
  -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

input:focus, textarea:focus {
    
    outline: none;
  border: 1px solid #4d90fe;
  -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
textarea {
   
    vertical-align: top;  
    height: 5em;   
    resize: vertical;
}
.button {
       padding-left: 90px; /* same size as the label elements */
}

button {
        margin-left: .5em;
}

</style>
   
</head>

<body>
             <form action="sendpage.php" method="post" name="contact_form">
    <div>
        <label for="name">Name:</label>
        <input type="text" id="name" />
    </div>
    <div>
        <label for="mail">E-mail:</label>
        <input type="email" id="mail" />
    </div>
    <div>
        <label for="mail">Mobile</label>
        <input type="number" id="mobile" />
    </div>
    <div>
        <label for="msg">Message:</label>
        <textarea id="msg"></textarea>
    </div>
   
    <div class="button">
        <button type="submit">Submit </button>
    </div>
</form>
</body>
</html>




No comments:

Post a Comment