Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
1 Introduction to HTML II อุทัย เซี่ยงเจ็น สำนักวิชาเทคโนโลยีสารสนเทศ และการสื่อสาร มหาวิทยาลัยนเรศวร พะเยา.
Images, Tables, lists, blocks, layout, forms, iframes
1 Chapter 5 – Handling HTML Controls in Web Pages spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Web Database Programming Input Validation. User Input on the Web Web browser built-in mechanisms –HTML Forms HTTP POST method –Hyperlinks HTTP GET method.
Creating Web Page Forms
PHP Forms. I. Using PHP with HTML Forms A very common application of PHP is to have an HTML form gather information from a website's visitor and then.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
HTML F ORMS. F ORMS HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons,
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CST JavaScript Validating Form Data with JavaScript.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
IS1500: Introduction to Web Development
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
HTML Forms What is a form.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
INTERNET APPLICATION DEVELOPMENT For More visit:
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
DAT602 Database Application Development Lecture 14 HTML.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
HTML : Forms, Frames Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
ITCS373: Internet Technology Lecture 5: More HTML.
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
HTML5 Forms Forms are used to capture user input …
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
1 HTML Forms
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
HTML Tables Tables are defined with the tag. A table is divided into rows (with the tag), and each row is divided into data cells (with the tag). td stands.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Validation and Building Small Apps
Introducing Forms.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Presentation transcript:

Unit 4 Working with data

Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, text area, field set and label elements. The tag is used to create an HTML form:

. input elements.

Input Element The most important form element is the input element. The input element is used to select user information. An input element can be different in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more. The most used input types are described below.

1. Text Fields defines a one-line input field that a user can enter text into: First name: Last name: Note: The form itself is not visible. Also note that the default width of a text field is 20 characters.

2. Password Field defines a password field: E.X:- Password: Note: The characters in a password field are masked (shown as asterisks or circles).

3. Radio Buttons defines a radio button. Radio buttons let a user select ONLY ONE one of a limited number of choices: Male Female

4. Checkboxes defines a checkbox. Checkboxes let a user select ONE or MORE options of a limited number of choices. I have a bike I have a car

5. Submit Button defines a submit button. A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input: Username:

6. Select (Pull Down menu) and Select multiple HTML form element This type of HTML form element is used to allow user to select from multiple choices. For example selecting a month or a day. The html syntax is as below

7. Hidden defines a hidden field. A hidden field is not visible for the user. Hidden fields often store a default value, or have their value changed by a JavaScript. Example:-

7. Image defines an image as a submit button. The src and alt attribute are required with. Example:-

Passing variables between pages 1.Passing variable through a GET $_GET Function:- The built-in $_GET function is used to collect values in a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.

Example Name: Age: When the user clicks the "Submit" button, the URL sent to the server could look something like this: me=Peter&age=37

Welcome ! You are years old.

The "welcome.php" file can now use the $_GET function to collect form data. When using method="get" in HTML forms, all variable names and values are displayed in the URL Note: 1. This method should not be used when sending passwords or other sensitive information! 2. The get method is not suitable for very large variable values. It should not be used with values exceeding 2000 characters.

2. Passing variable through a POST:- The built-in $_POST function is used to collect values from a form sent with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).

Example Name: Age: When the user clicks the "Submit" button, the URL will look like this:

The "welcome.php" file can now use the $_POST function to collect form data (the names of the form fields will automatically be the keys in the $_POST array): E.X:- Welcome ! You are years old. Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

3. Passing variable through a REQUEST:- The PHP built-in $_REQUEST function contains the contents of both $_GET, $_POST, and $_COOKIE. The $_REQUEST function can be used to collect form data sent with both the GET and POST methods.

Example:- Firstname: Lastname: ; echo “Lastname: “ $_REQUEST[“lastname”]; ?>

Validating the user input "never trust user input" is the golden rule on the web. There are several types of problem that’s why we need the validation on user input. Problems like 1. Mistake on input. User types 1095 rather than Bad input. User purposefully provides incorrect input in attempt to gain advantage 3. Dangerous input. User innocently enters information that would harm the system 4. Missing input. User provides no input.

When validating input, we have two choices: 1.validate on the client side using a scripting language. 2. validate on the server side using PHP.

1. Client side Validation using a scripting language You can write scripting code that will verify form fields contain good data before being submitted to the server, and this is often used. The advantages to using client-side validation are: 1.users receive feedback quicker 2.it saves load on the server - more work is done on the client side.

The disadvantage to using client-side validation are: 1. client-side support for varies scripting languages, with some browsers supporting scripts very well, others supporting bits and pieces, and others supporting nothing at all. 2. Furthermore, clever users can disable your client-side checking in order to feed you bad data - if you only apply client-side checking, you are bound to get hacked eventually.

Server side validate using PHP. Server-side data validation means using PHP to verify that good values have been sent to the script. Using server-side validation has pretty much the exact opposite of client-side development: it is more secure and works with all browsers, but it is costly and slower feedback for users.

One big advantage to server-side validation is that you can use PHP - a language by now you have attained some skill with. As you know, PHP has a wide variety of functions and language features to help you cut and change strings, check numbers are within ranges, and so on. Furthermore, you can use PHP to connect to a database to check whether a username exists, for example, which is simply impossible using client-side scripting.