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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Tutorial 6 Working with Web Forms
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
USER INTERACTIONS: FORMS
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
CST JavaScript Validating Form Data with JavaScript.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
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.
COM336 – Web Database Development XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Web forms in PHP Forms Recap  Way of allowing user interaction  Allows users to input data that can then be processed by a program / stored in a back-end.
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.
Brief Overview of Web Forms L. G. Piper Bunker Hill Community College 23 March 2011.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
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.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 7: Web Forms.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 7: Web Forms © 2007 Prosoft Learning Corporation All rights reserved ITD 110 Web Page Design.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
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.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
76 © 1998, 1999, 2000 David T. Gray, Howard Duncan, Jane Kernan Frames When displaying information in a browser, it is sometimes useful to divide the display.
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,
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms A form is the usual way to communicate information from a Web browser to a server HTML has.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
1 HTML Forms
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.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms - A form is the usual way information is gotten from a browser to a server - HTML has tags.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Page Design Forms! Website Design. Objectives What forms can do The Attributes of the form tag Using Textboxes Textareas Checkboxes Radio buttons.
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.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
HTML Forms.
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.
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
CIS 228 The Internet 12/6/11 Forms and Validation.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
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.
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,
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.
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Validation and Building Small Apps
Introducing Forms.
Forms, cont’d.
Presentation transcript:

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 – id is optional (but encouraged in XHTML) action is mandatory. The value is the URL (or name of the file, if in current directory) where the data collected by the form is to be sent method can take one of two values: get and post 2

HTML forms HTML forms (a way of getting input from the browser) include form elements such as: – text areas – password areas – check boxes – selection lists – scrolled selection lists – radio buttons – submit button – reset button – picture buttons 3

An HTML form 4

5

Using method=“get” This method appends the form-data to the URL in name/value pairs This method is useful for form submissions where a user want to bookmark the result (think google search) There is a limit to how much data you can place in a URL (varies between browsers), therefore, you cannot be sure that all of the form-data will be correctly transferred Never use the "get" method to pass sensitive information! (password or other sensitive information will be visible in the browser's address bar) 6

Using method=“post” This method sends the form-data as an HTTP post transaction Form submissions with the "post" method cannot be bookmarked (think login forms or member only areas) The "post" method is more robust and secure than "get", and "post" does not have size limitations 7

PHP Superglobals $_GET $_POST Works in the same way as $_GET – $_POST is an associative array – The keys to the array are the same as the field names in your form – Data sent via post is not exposed to the browser. The transaction is handled internally by the webserver 8

HTML form tags - overview 9

Starting and ending forms - tag HTML forms are created by using the HTML and tags Within these tags, you place various HTML form elements, such as text areas, check boxes, and radio buttons..  ---(Your FORM elements here). 10

Form arguments The tag has two primary arguments: action - Specifies the URL of the PHP script to start when the form is submitted method - Defines the format that will be used to send data to the PHP script – get appends the form arguments to the end of the Web address (as a Query String after the “?”) – post sends the data as part of the body of the HTTP Request 11

The tag Used to define a range of form elements, designated by its TYPE attribute. The general format of the tag is: – type = submit | reset | text | checkbox | radio| etc. – name: will be used by the CGI program to identify the form element (i.e. the CGI variable) – value: the value to be associated with “name” when processing the form (The tag has NO closing tag ) 12

The tag - Form buttons Used to submit the form or erase all input When the submit button is clicked, the form data is sent to the program specified in the ACTION argument, and the CGI program executed If form consists only of a submit button, the CGI program is simply executed 13

tag - Text box The text input type creates text boxes on forms 14 text area box size max. characters allowed CGI variable name

tag - Text box 15

Text areas - tag 16 u Enables the user to enter multiple lines of text Please enter comments here u The wrap attribute specifies what to do if the user types beyond the right margin of the text area If omitted, wrapping is not enabled If wrap=“virtual”, wrapping is enabled but the text is submitted without linebreaks If wrap=“physical”, line breaks are submitted as part of the text CGI variable name default text value

tag - Checkboxes 17 Copyright © 2002 Pearson Education, Inc.

tag - Checkboxes Small boxes on a form that create a check mark when the user clicks them USA China The user may select (tick) multiple boxes 18 CGI variable name CGI variable value when clicked label displayed next to checkbox

tag - Radio buttons 19 Copyright © 2002 Pearson Education, Inc.

Radio buttons - tag Small circles that operate similarly to checkboxes, except that only one button within the group can be selected at any given time Visa American Express Mastercard 20 CGI variable name CGI variable value label displayed next to radio button

tag - Selection lists Used to create a list for user to choose from, either as a drop- down menu or a scrolling box: Win95 Win98 Win2k linux For a scrolling box, specify SIZE greater than one. e.g. SIZE = 3 will generate a scrolling windows 3 rows high 21 CGI variable name list items that user can select CGI variable value

Form generation using PHP - Example 22

Form generation using PHP - Example - output 23

Example form Selection list Radio buttons Text box Text area Text box Submit button