Session 8 working with form
This presentation is the property of its rightful owner.
Sponsored Links
1 / 26

Session 8: Working with Form PowerPoint PPT Presentation


  • 166 Views
  • Uploaded on
  • Presentation posted in: General

Session 8: Working with Form. iNET Academy Open Source Web Development. Objectives. Bulding a Form and Accessing Form’s Values Types of Input & Validating Data Query the DB with form data Using Template. Building a Form. Every form must have three basic components

Download Presentation

Session 8: Working with Form

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Session 8 working with form

Session 8: Working with Form

iNET Academy

Open Source Web Development


Objectives

Objectives

  • Bulding a Form and Accessing Form’s Values

  • Types of Input & Validating Data

  • Query the DB with form data

  • Using Template


Building a form

Building a Form

  • Every form must have three basic components

    • The submission type defined with the method keyword

    • One or more input elements defined with the input tag

    • The destination to go to when submitted defined with the action keyword


Accessing submitted form values

Accessing Submitted Form Values

  • Using


Accessing submitted form values cont

Accessing Submitted Form Values (cont.)

  • Use super global variables

    • $_GET[field]

    • $_POST[field]

    • $_REQUEST[field]

  • register_globals should be off


Default values

Default Values


Types of input text boxes

Types of Input – Text boxes

  • Used to capture strings from the user

    • The name attribute: used to reference to the value

    • The size attribute: specifies the length of the text box

    • The maxlength attribute: determines the maximum number of characters


Types of input text areas

Types of Input – Text areas

  • A text area is defined using the text area element

    • The name attribute

    • The cols attribute: specifies how many character columns to create

    • The rows attribute: specifies how many rows to create


Types of input check boxes

Types of Input – Check boxes

  • Used to give users several different options

    • Use input element with type=“checkbox”

    • The name attribute

    • The value attribute


Types of input radio button

Types of Input – Radio Button

  • Give the user several choice but can choose only one value


Types of input hidden

Types of Input - Hidden

  • The information of hidden fields is not visible to the users


Types of input selects

Types of Input - Selects

  • Present a list of options to the user

  • Attributes of the <select>

    • The name attribute

    • The size attribute: specifies how many lines of the list appear in the browser window

    • The multiple attribute: allow the user to select more than one item from the list

  • Attributes of the <option>

    • The selected attribute specifies a default selection

    • The value attribute specifies a value that is different from the label of the option. If no value is specidied, the label is used as the value


Types of input selects cont

Types of Input – Selects (cont.)


Working with multiple values

Working with Multiple Values


Working with multiple values cont

Working with Multiple Values (cont.)


Validating data

Validating Data

  • Always validate data getting from users

  • Validating checkboxes, radio buttons and selects


Validating data cont

Validating Data (cont.)

  • Validating text boxes and text areas

    • Decide which information is valid and which is not

    • Check for empty values

    • Check for other conditions like @ in a email field


Building a feet to meters converter in php

Building a Feet-to-Meters Converter in PHP


Building a time zone conversion utility in php

Building a Time-Zone Conversion Utility in PHP


Building a time zone conversion utility in php cont

Building a Time-Zone Conversion Utility in PHP (cont.)


Building a time zone conversion utility in php cont1

Building a Time-Zone Conversion Utility in PHP (cont.)


Query the db with form data

Query the Db with Form Data


Query the db with form data cont

Query the Db with Form Data (cont.)


Query the db with form data cont1

Query the Db with Form Data (cont.)


Query the db with form data cont2

Query the Db with Form Data (cont.)


Practice

Practice

  • In this practice, you will

    • Write an program to search for a book based on only one of three following condition

      • Author

      • Title

      • Price


  • Login