SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
HTML :: FORMS
www.eshikshak.co.in
Introduction
   HTML Forms are required when you want to
    collect some data from the site visitor. For example
    registration information: name, email address,
    credit card, etc.
   Form elements are like text fields, textarea fields,
    drop-down menus, radio buttons, checkboxes, etc.
    which are used to take information from the user.



                          www.eshikshak.co.in
<form action="back-end script" method="posting
method">
    form elements like input, textarea etc.
</form>




                         www.eshikshak.co.in
Most frequently used form attributes
   name: This is the name of the form.
   action: Here you will specify any script URL which will receive uploaded
    data.
   method: Here you will specify method to be used to upload data. It can
    take various values but most frequently used are GET and POST.
   target: It specifies the target page where the result of the script will be
    displayed. It takes values like _blank, _self, _parent etc.
   enctype: You can use the enctype attribute to specify how the browser
    encodes the data before it sends it to the server. Possible values are like:
       application/x-www-form-urlencoded - This is the standard method most
        forms use. It converts spaces to the plus sign and non-alphanumeric characters
        into the hexadecimal code for that character in ASCII text.
       mutlipart/form-data - This allows the data to be sent in parts, with each
        consecutive part corresponding the a form control, in the order they appear in
        the form. Each part can have an optional content-type header of its own
        indicating the type of data for that form control.

                                         www.eshikshak.co.in
Most frequently used form attributes

   There are different types of form controls that you
    can use to collect data from a visitor to your site.
     Text  input controls
     Buttons

     Checkboxes and radio buttons

     Select boxes

     File select boxes

     Hidden controls

     Submit and reset button


                           www.eshikshak.co.in
Single-line text input controls
   Single-line text input controls are created using an <input>
    element whose type attribute has a value of text.
   Here is a basic example of a single-line text input used to take
    first name and last name
    <form action="/cgi-bin/hello_get.cgi" method="get">
    First name:
    <input type="text" name="first_name" />
    <br>
    Last name:
    <input type="text" name="last_name" />
    <input type="submit" value="submit" />
    </form>

                                www.eshikshak.co.in
<Input> tag attributes
   Following is the list of attributes for <input> tag.
     type: Indicates the type of input control you want to create.
      This element is also used to create other form controls such
      as radio buttons and checkboxes.
     name: Used to give the name part of the name/value pair
      that is sent to the server, representing each form control and
      the value the user entered.
     value: Provides an initial value for the text input control
      that the user will see when the form loads.
     size: Allows you to specify the width of the text-input
      control in terms of characters.
     maxlength: Allows you to specify the maximum number of
      characters a user can enter into the text box.

                                www.eshikshak.co.in
Password input controls
   This is also a form of single-line text input controls are created
    using an <input> element whose type attribute has a value of
    password.
   Here is a basic example of a single-line password input used
    to take user password:

    <form action="/cgi-bin/hello_get.cgi" method="get">
    Login :
    <input type="text" name="login" />
    <br>
    Password:
    <input type="text" name="password" />
    <input type="submit" value="submit" />
    </form>
                                 www.eshikshak.co.in
Multiple-Line Text Input
Controls
   To allow a visitor to your site to enter more than one line of text, you
    should create a multiple-line text input control using the <textarea>
    element.
   Here is a basic example of a multi-line text input used to take item
    description:
    <form action="/cgi-bin/hello_get.cgi" method="get">
    Description : <br />
    <textarea rows="5" cols="50" name="description">
    Enter description here...
    </textarea>
    <input type="submit" value="submit" />
    </form>



                                      www.eshikshak.co.in
<textarea> tag attributes
   name: The name of the control. This is used in the
    name/value pair that is sent to the server.
   rows: Indicates the number of rows of text area
    box.
   cols: Indicates the number of columns of text area
    box.




                          www.eshikshak.co.in
HTML Forms - Creating Button
   There are various ways in HTML to create clickable
    buttons. You can create clickable button using <input>
    tag.
   When you use the <input> element to create a button,
    the type of button you create is specified using the type
    attribute. The type attribute can take the following
    values:
     submit: This creates a button that automatically submits a
      form.
     reset: This creates a button that automatically resets form
      controls to their initial values.
     button: This creates a button that is used to trigger a client-
      side script when the user clicks that button.
                                www.eshikshak.co.in
Example

<form action="http://www.example.com/test.asp"
method="get">
<input type="submit" name="Submit" value="Submit" />
<br /><br />
<input type="reset" value="Reset" />
<input type="button" value="Button" />
</form>




                         www.eshikshak.co.in
HTML Forms - Checkboxes
Control
   Checkboxes are used when more than one option is required
    to be selected. They are created using <input> tag as shown
    below.
   Here is example HTML code for a form with two checkboxes

    <form action="/cgi-bin/checkbox.cgi" method="get">
    <input type="checkbox" name="maths" value="on"> Maths
    <input type="checkbox" name="physics" value="on"> Physics
    <input type="submit" value="Select Subject" />
    </form>




                                www.eshikshak.co.in
   Following is the list of important checkbox
    attributes:
     type: Indicates that you want to create a checkbox.
     name: Name of the control.

     value: The value that will be used if the checkbox is
      selected. More than one checkbox should share the
      same name only if you want to allow users to select
      several items from the same list.
     checked: Indicates that when the page loads, the
      checkbox should be selected.
                             www.eshikshak.co.in
HTML Forms - Raidobox
Control
   Radio Buttons are used when only one option is required to be
    selected. They are created using <input> tag as shown below:
   Here is example HTML code for a form with two radio
    button:

<form action="/cgi-bin/radiobutton.cgi" method="post">
<input type="radio" name="subject" value="maths" />
Maths
<input type="radio" name="subject" value="physics" />
Physics
<input type="submit" value="Select Subject" />
</form>


                               www.eshikshak.co.in
   Following is the list of important radiobox
    attributes:
     type: Indicates  that you want to create a radiobox.
     name: Name of the control.

     value: Used to indicate the value that will be sent to
      the server if this option is selected.
     checked: Indicates that this option should be selected
      by default when the page loads.



                             www.eshikshak.co.in
HTML Forms - Select box
Control
   Drop Down Box is used when we have many options
    available to be selected but only one or two will be selected..
   Here is example HTML code for a form with one drop down
    box
    <form action="/cgi-bin/dropdown.cgi"
    method="post">
    <select name="dropdown">
    <option value="Maths"
    selected>Maths</option>
    <option value="Physics">Physics</option>
    </select>
    <input type="submit" value="Submit" />
    </form>

                               www.eshikshak.co.in
   Following is the list of important attributes of <select>:
     name: This is the name for the control.
     size: This can be used to present a scrolling list box.
     multiple: If set to "multiple" then allows a user to select
      multiple items from the menu.
   Following is the list of important attributes of
    <option>:
     value: The value that is sent to the server if this option is
      selected.
     selected: Specifies that this option should be the initially
      selected value when the page loads.
     label: An alternative way of labeling options.
                                 www.eshikshak.co.in
HTML Forms - File Select Boxes
  To allow a user to upload a file to your web site from his
   computer, you will need to use a file upload box, also known
   as a file select box. This is also created using the <input>
   element.
 Here is example HTML code for a form with one file select

   box
<form action="/cgi-bin/hello_get.cgi" method="post"
      name="fileupload" enctype="multipart/form-data">
<input type="file" name="fileupload" accept="image/*" />
</form>




                              www.eshikshak.co.in
HTML Forms - Hidden Controls
   To pass information between pages without the user
    seeing it. Hidden form controls remain part of any
    form, but the user cannot see them in the Web browser.
   It should not be used for any sensitive information you
    do not want the user to see because the user could see
    this data if she looked in the source of the page.
   Hidden form is being used to keep current page
    number.
   When a user will click next page then the value of
    hidden form will be sent to the back-end application
    and it will decide which page has be displayed next.
                            www.eshikshak.co.in
HTML Forms - Hidden Controls

<form action="/cgi-bin/hello_get.cgi"
         method="get" name="pages">
<p>This is page 10</p>
<input type="hidden" name="pgaenumber" value="10" />
<input type="submit" value="Next Page" />
</form>




                            www.eshikshak.co.in
HTML Forms - Submit and Reset
Button
    These are special buttons which can be created using <input> When
     submit button is clicked then Forms data is submitted to the back-end
     application. When reset button is clicked then all the forms control are
     reset to default state.
    You already have seen submit button above, we will give one reset
     example here:
    <form action="/cgi-bin/hello_get.cgi" method="get">
    First name:
    <input type="text" name="first_name" />
    <br>
    Last name:
    <input type="text" name="last_name" />
    <input type="submit" value="Submit" />
    <input type="reset" value="Reset" />
    </form>
                                    www.eshikshak.co.in

Contenu connexe

Tendances

Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Chris Poteet
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSSMario Hernandez
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Formstina1357
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/jsKnoldus Inc.
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designersSingsys Pte Ltd
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!Ana Cidre
 
Html table tags
Html table tagsHtml table tags
Html table tagseShikshak
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptFahim Abdullah
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overviewJacob Nelson
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS Dave Kelly
 

Tendances (20)

CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Html forms
Html formsHtml forms
Html forms
 
html forms
html formshtml forms
html forms
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Css ppt
Css pptCss ppt
Css ppt
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
Css pseudo-classes
Css pseudo-classesCss pseudo-classes
Css pseudo-classes
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
 
Html table tags
Html table tagsHtml table tags
Html table tags
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Css
CssCss
Css
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
 
Html forms
Html formsHtml forms
Html forms
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 

En vedette

Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTMLDoncho Minkov
 
Introduction to computer_and_its_structure
Introduction to computer_and_its_structureIntroduction to computer_and_its_structure
Introduction to computer_and_its_structureeShikshak
 
Lecture 11 css_inculsion
Lecture 11 css_inculsionLecture 11 css_inculsion
Lecture 11 css_inculsioneShikshak
 
Lecture 12 css_fonts
Lecture 12 css_fontsLecture 12 css_fonts
Lecture 12 css_fontseShikshak
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to csseShikshak
 
Program development cyle
Program development cyleProgram development cyle
Program development cyleeShikshak
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTMLMarlon Jamera
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppteShikshak
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugageseShikshak
 
Open Source and Open Data in the Age of the Cloud
Open Source and Open Data in the Age of the CloudOpen Source and Open Data in the Age of the Cloud
Open Source and Open Data in the Age of the CloudTim O'Reilly
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloudeShikshak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'eShikshak
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computingeShikshak
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computingeShikshak
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppteShikshak
 
Introduction to multimedia
Introduction to multimediaIntroduction to multimedia
Introduction to multimediaeShikshak
 
HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML formsNadine Cruz
 

En vedette (20)

Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Introduction to computer_and_its_structure
Introduction to computer_and_its_structureIntroduction to computer_and_its_structure
Introduction to computer_and_its_structure
 
Lecture 11 css_inculsion
Lecture 11 css_inculsionLecture 11 css_inculsion
Lecture 11 css_inculsion
 
Lecture 12 css_fonts
Lecture 12 css_fontsLecture 12 css_fonts
Lecture 12 css_fonts
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
 
Program development cyle
Program development cyleProgram development cyle
Program development cyle
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
 
Open Source and Open Data in the Age of the Cloud
Open Source and Open Data in the Age of the CloudOpen Source and Open Data in the Age of the Cloud
Open Source and Open Data in the Age of the Cloud
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloud
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computing
 
Html 5 Forms
Html 5 FormsHtml 5 Forms
Html 5 Forms
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computing
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
 
Introduction to multimedia
Introduction to multimediaIntroduction to multimedia
Introduction to multimedia
 
Basic css-tutorial
Basic css-tutorialBasic css-tutorial
Basic css-tutorial
 
HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML forms
 

Similaire à Html forms (20)

Html forms
Html formsHtml forms
Html forms
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
 
Html5ppt
Html5pptHtml5ppt
Html5ppt
 
Html4
Html4Html4
Html4
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
Chapter09
Chapter09Chapter09
Chapter09
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
 
Html4
Html4Html4
Html4
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
Cmsc 100 (web forms)
Cmsc 100 (web forms)Cmsc 100 (web forms)
Cmsc 100 (web forms)
 
Web design - Working with forms in HTML
Web design - Working with forms in HTMLWeb design - Working with forms in HTML
Web design - Working with forms in HTML
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Forms.pptx
Forms.pptxForms.pptx
Forms.pptx
 
Web topic 20 2 html forms
Web topic 20 2  html formsWeb topic 20 2  html forms
Web topic 20 2 html forms
 

Plus de eShikshak

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluationeShikshak
 
Operators in python
Operators in pythonOperators in python
Operators in pythoneShikshak
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in pythoneShikshak
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythoneShikshak
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerceeShikshak
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computingeShikshak
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computingeShikshak
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'eShikshak
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executionseShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__elseeShikshak
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssionseShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variableseShikshak
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorseShikshak
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppteShikshak
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppteShikshak
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppteShikshak
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppteShikshak
 
Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppteShikshak
 

Plus de eShikshak (20)

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerce
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computing
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computing
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executions
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operators
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppt
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppt
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
 
Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppt
 

Dernier

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Dernier (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Html forms

  • 2. Introduction  HTML Forms are required when you want to collect some data from the site visitor. For example registration information: name, email address, credit card, etc.  Form elements are like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc. which are used to take information from the user. www.eshikshak.co.in
  • 3. <form action="back-end script" method="posting method"> form elements like input, textarea etc. </form> www.eshikshak.co.in
  • 4. Most frequently used form attributes  name: This is the name of the form.  action: Here you will specify any script URL which will receive uploaded data.  method: Here you will specify method to be used to upload data. It can take various values but most frequently used are GET and POST.  target: It specifies the target page where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.  enctype: You can use the enctype attribute to specify how the browser encodes the data before it sends it to the server. Possible values are like:  application/x-www-form-urlencoded - This is the standard method most forms use. It converts spaces to the plus sign and non-alphanumeric characters into the hexadecimal code for that character in ASCII text.  mutlipart/form-data - This allows the data to be sent in parts, with each consecutive part corresponding the a form control, in the order they appear in the form. Each part can have an optional content-type header of its own indicating the type of data for that form control. www.eshikshak.co.in
  • 5. Most frequently used form attributes  There are different types of form controls that you can use to collect data from a visitor to your site.  Text input controls  Buttons  Checkboxes and radio buttons  Select boxes  File select boxes  Hidden controls  Submit and reset button www.eshikshak.co.in
  • 6. Single-line text input controls  Single-line text input controls are created using an <input> element whose type attribute has a value of text.  Here is a basic example of a single-line text input used to take first name and last name <form action="/cgi-bin/hello_get.cgi" method="get"> First name: <input type="text" name="first_name" /> <br> Last name: <input type="text" name="last_name" /> <input type="submit" value="submit" /> </form> www.eshikshak.co.in
  • 7. <Input> tag attributes  Following is the list of attributes for <input> tag.  type: Indicates the type of input control you want to create. This element is also used to create other form controls such as radio buttons and checkboxes.  name: Used to give the name part of the name/value pair that is sent to the server, representing each form control and the value the user entered.  value: Provides an initial value for the text input control that the user will see when the form loads.  size: Allows you to specify the width of the text-input control in terms of characters.  maxlength: Allows you to specify the maximum number of characters a user can enter into the text box. www.eshikshak.co.in
  • 8. Password input controls  This is also a form of single-line text input controls are created using an <input> element whose type attribute has a value of password.  Here is a basic example of a single-line password input used to take user password: <form action="/cgi-bin/hello_get.cgi" method="get"> Login : <input type="text" name="login" /> <br> Password: <input type="text" name="password" /> <input type="submit" value="submit" /> </form> www.eshikshak.co.in
  • 9. Multiple-Line Text Input Controls  To allow a visitor to your site to enter more than one line of text, you should create a multiple-line text input control using the <textarea> element.  Here is a basic example of a multi-line text input used to take item description: <form action="/cgi-bin/hello_get.cgi" method="get"> Description : <br /> <textarea rows="5" cols="50" name="description"> Enter description here... </textarea> <input type="submit" value="submit" /> </form> www.eshikshak.co.in
  • 10. <textarea> tag attributes  name: The name of the control. This is used in the name/value pair that is sent to the server.  rows: Indicates the number of rows of text area box.  cols: Indicates the number of columns of text area box. www.eshikshak.co.in
  • 11. HTML Forms - Creating Button  There are various ways in HTML to create clickable buttons. You can create clickable button using <input> tag.  When you use the <input> element to create a button, the type of button you create is specified using the type attribute. The type attribute can take the following values:  submit: This creates a button that automatically submits a form.  reset: This creates a button that automatically resets form controls to their initial values.  button: This creates a button that is used to trigger a client- side script when the user clicks that button. www.eshikshak.co.in
  • 12. Example <form action="http://www.example.com/test.asp" method="get"> <input type="submit" name="Submit" value="Submit" /> <br /><br /> <input type="reset" value="Reset" /> <input type="button" value="Button" /> </form> www.eshikshak.co.in
  • 13. HTML Forms - Checkboxes Control  Checkboxes are used when more than one option is required to be selected. They are created using <input> tag as shown below.  Here is example HTML code for a form with two checkboxes <form action="/cgi-bin/checkbox.cgi" method="get"> <input type="checkbox" name="maths" value="on"> Maths <input type="checkbox" name="physics" value="on"> Physics <input type="submit" value="Select Subject" /> </form> www.eshikshak.co.in
  • 14. Following is the list of important checkbox attributes:  type: Indicates that you want to create a checkbox.  name: Name of the control.  value: The value that will be used if the checkbox is selected. More than one checkbox should share the same name only if you want to allow users to select several items from the same list.  checked: Indicates that when the page loads, the checkbox should be selected. www.eshikshak.co.in
  • 15. HTML Forms - Raidobox Control  Radio Buttons are used when only one option is required to be selected. They are created using <input> tag as shown below:  Here is example HTML code for a form with two radio button: <form action="/cgi-bin/radiobutton.cgi" method="post"> <input type="radio" name="subject" value="maths" /> Maths <input type="radio" name="subject" value="physics" /> Physics <input type="submit" value="Select Subject" /> </form> www.eshikshak.co.in
  • 16. Following is the list of important radiobox attributes:  type: Indicates that you want to create a radiobox.  name: Name of the control.  value: Used to indicate the value that will be sent to the server if this option is selected.  checked: Indicates that this option should be selected by default when the page loads. www.eshikshak.co.in
  • 17. HTML Forms - Select box Control  Drop Down Box is used when we have many options available to be selected but only one or two will be selected..  Here is example HTML code for a form with one drop down box <form action="/cgi-bin/dropdown.cgi" method="post"> <select name="dropdown"> <option value="Maths" selected>Maths</option> <option value="Physics">Physics</option> </select> <input type="submit" value="Submit" /> </form> www.eshikshak.co.in
  • 18. Following is the list of important attributes of <select>:  name: This is the name for the control.  size: This can be used to present a scrolling list box.  multiple: If set to "multiple" then allows a user to select multiple items from the menu.  Following is the list of important attributes of <option>:  value: The value that is sent to the server if this option is selected.  selected: Specifies that this option should be the initially selected value when the page loads.  label: An alternative way of labeling options. www.eshikshak.co.in
  • 19. HTML Forms - File Select Boxes  To allow a user to upload a file to your web site from his computer, you will need to use a file upload box, also known as a file select box. This is also created using the <input> element.  Here is example HTML code for a form with one file select box <form action="/cgi-bin/hello_get.cgi" method="post" name="fileupload" enctype="multipart/form-data"> <input type="file" name="fileupload" accept="image/*" /> </form> www.eshikshak.co.in
  • 20. HTML Forms - Hidden Controls  To pass information between pages without the user seeing it. Hidden form controls remain part of any form, but the user cannot see them in the Web browser.  It should not be used for any sensitive information you do not want the user to see because the user could see this data if she looked in the source of the page.  Hidden form is being used to keep current page number.  When a user will click next page then the value of hidden form will be sent to the back-end application and it will decide which page has be displayed next. www.eshikshak.co.in
  • 21. HTML Forms - Hidden Controls <form action="/cgi-bin/hello_get.cgi" method="get" name="pages"> <p>This is page 10</p> <input type="hidden" name="pgaenumber" value="10" /> <input type="submit" value="Next Page" /> </form> www.eshikshak.co.in
  • 22. HTML Forms - Submit and Reset Button  These are special buttons which can be created using <input> When submit button is clicked then Forms data is submitted to the back-end application. When reset button is clicked then all the forms control are reset to default state.  You already have seen submit button above, we will give one reset example here: <form action="/cgi-bin/hello_get.cgi" method="get"> First name: <input type="text" name="first_name" /> <br> Last name: <input type="text" name="last_name" /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> www.eshikshak.co.in