Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.

Slides:



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

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.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
How to Make a Web Page: A Crash Course in HTML programming.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Python and Web Programming
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.
Yahoo Tutorial This tutorial aims to quickly cover some of the basic elements of web based using Yahoo - a free service Use the Index.
Gmail Tutorial This tutorial aims to quickly cover some of the basic elements of web based using Gmail - a free service Use the Index on the.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
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.
Hotmail Tutorial This tutorial aims to quickly cover some of the basic elements of web based using msn Hotmail - a free service Use the Index.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
ITM © Port, Kazman1 ITM 352 HTML Forms, Basic Form Processing.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
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.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
CO1552 Web Application Development HTML Forms. Websites can be made more interactive by providing facilities for users to provide data To get user entered.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Forms and Form Controls Chapter What is a Form?
Let’s Make An Form! Bonney Armstrong GD 444 Westwood College February 9, 2005.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
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.
HTML Concepts and Techniques Fourth Edition Project 7 Creating a Form on a Web Page.
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.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 HTML Forms
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms.
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.
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.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
1 Building FORMS In When a visitor enters information into a web form displayed in a web browser and clicks the submit button, the information is sent.
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.
Web Forms. Survey or poll Contact us Sign up for an newsletter Register for an event Submit comments or feedback about our site Log in to a members-only.
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.
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.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
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.
1 HTML Forms
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.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Advanced HTML Tags:.
LMEvents SharePoint Portal How-to Guide
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Creating Forms on a Web Page
Presentation transcript:

Forms and Server Side Includes

What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses using web advisor? Web advisor makes good use of forms! Usually forms consist of two different parts: Input this is where users type in things / click on options Submit & Reset these buttons submit the data in the form for processing (more on this later) or reset the input areas to their original value,

What goes in a Form? A form is defined using the tag. In between and you can have: Input Areas Buttons Text Any HTML element

Let’s do an example! START  Programs  Accessories  Notepad Save the file as form.html Remember to save it as type: ‘All Files’

Form Example

Input Areas Most input areas are defined using the tag Tag properties / parameters in the tag tell the browser what kind of input it is and what kind of information the user is inputting You can also define things like input area size and the default value with tag properties / parameters

Input areas The usual input tag structure looks like this: The input opening tag tells the web browser that the user will be able to enter input here The type parameter is required to tell the browser what kind of input area to display The name parameter tells the browser how to refer to the input area This is incredibly important so that YOU also can know how to refer to a specific input area!

Text Fields (type = “text”) Text fields are used when you want the user to type in a word or number The general structure looks like this: Two useful parameters: size  specifies the length of the text field in characters Most browsers have a default text field size of 20 characters value  sets the default value of the text field Is overwritten when the user adds information into the text field

Text Field Example

Text Field Example (cont’d) Don’t forget to tell your users what you want them to enter into the input area! Just let them know by adding some plain text and/or html tags to your form

Password Field (type = “password”) Password fields are used when you want the user to type in a password The general structure looks like this: The size and value parameters can also be used with password field, however, anything used for the “value” parameter will be displayed as stars (*) Also, don’t forget to put in something to tell your user that you are looking for a password!

Password Fields (cont’d) A password box is almost exactly the same as a text input, except that everything the user types is displayed as stars (*) This is to avoid a security problem known as “shoulder surfing”

Radio Buttons (type = “radio”) Radio buttons are used when you want the user to pick one option from a list of options The general structure looks like this: name  the name of the whole list of radio buttons value  the name of one of the radio buttons

Radio Buttons (cont’d) Try adding two radio buttons to your form: option 1 option 2 Also, you can make it so that one of the radio buttons is already checked by default:

Check Boxes (type = “checkbox”) Check Boxes are used when you want the user to pick one or more options from a list of options The general structure looks like this: name  the name of the whole list of check boxes value  the name of one of the check boxes

Check Boxes (cont’d) Try adding two check boxes to your form: option 1 option 2 Also, you can make it so that any of the check boxes is already checked by default:

Text Areas Text areas are used when you want the user to input multiple lines of text For example, areas for writing comments The general structure looks like this: Any default text that you wish to add goes in between the opening and closing textarea tags

Text Areas (cont’d) The “rows” and “cols” parameters are used to determine the size of the text area Try inserting a text area: This is the default text inside the text area

Drop Down Lists Drop down lists are similar to regular lists There’s a tag to start the list and tags for each of the options in the list The general structure looks like this: Option Display Text

Drop Down Lists (cont’d) In the tag, the name parameter refers to the name of the entire list In the tags, the value parameters refer to the names of the individual options in the list Try adding a drop down list to your form: Option 1 Option 2

Fieldsets Fieldsets are used to separate user input areas into groups Places a border around whatever is inside it For example, if you had questions on a number of different topics, you might want to visually separate them Use the tag to show what will be in the box Also, you can use tag inside the fieldset to put text around the border. Ok, let’s look at a quick example…

Fieldset Example

Fieldset Example (cont’d)

The Reset Button (type = “reset”) Reset buttons restore the default values in the form The general structure looks like this: Try adding a reset button to your form:

The Submit Button (type = “submit”) The general structure looks like this: When the submit button is pressed, the data from the form is sent to another page or program for processing But how does it know where to send it?….

Submit Actions You tell the server where to send your form information by using parameters inside the tag The “action” parameter tells the server where to send it The “method” parameter tells the server how to send it A full form tag that will actually do something with your data. The general structure looks like this:

The method Parameter There are two different ways to send data: Get – sends the data to the next page by attaching it to the url Advantages – you can bookmark the page and all the data from the form is retained as a part of the URL Disadvantages – people can see it - there are limits on the amount of data that can be sent this way Post – sends the data to the next page through the server Advantages – makes it so people can’t easily see your data - no limit on the amount of data that can be sent Disadvantages – you can’t use a bookmark to see the page Most programs use post you should use post to send that for your assignment #3

The action Parameter If you had something specific you wanted to do with the data you could write your own script For example, collect it in a file, run an analysis of it, etc… This is fairly difficult because you need to have some knowledge of programming Fortunately, the general server provides a script that you can use to the form results to yourself. this is fairly common and many servers have services like this

Guelph Form Mailer To use the Guelph form mailer: Action: Method: post This is what you should use for assignment #3

Guelph Form Mailer (cont’d) Because everyone in the school can use the form mailer, it is pretty generic you need to tell the program certain things like where to send the mail, what you want it called, etc… So how do we send the program this info Hidden input tags!

Hidden When a form is completed, and the submit button is pressed, the form information is sent to a program or script for processing Hidden input tags are used to send additional information to this program Because the user cannot see the inputs, they cannot change the values

Hidden (cont’d) To add a hidden input tag: These tags will not show on the page We will need hidden input tags in order to use the University of Guelph’s Form Mailer

FormMail – Required Fields A hidden input field named “recipient” that will tell the form where to send the mail – change the address to where you want it sent This MUST be address A hidden input field named “ ” to tell it where to send the from This just tells the program what account to use to send the mail – use your address

FormMail – Optional Fields You can have the user input an address into a text field so that when the form is sent, it appears to be coming from the user specified address You can determine the subject (title) of the being sent with the Form Mailer in a hidden field named “subject”:

FormMail – Optional Fields (cont’d) If you choose, you can make it so that when the submit button is clicked, it will redirect you to another webpage. This is done with another hidden field that tells the program where to send the user after submitting the form. Make sure you use the absolute page address because the program is located in a totally different area than your home page. For example… value=“

Example!! Here’s a special treat for showing up to lab… Tune your browser to:

Hints for Testing When you first write your form, put in your OWN address as the place to send it to, otherwise you will not be able to tell if it works Make sure to change the address to after you know your form works You have to post your page to general in order to use the Guelph Form Mailer

Server Side Includes (SSI) This section about SSI is just for your knowledge and you may or may not use it. When you have a number of different pages, usually they share some common elements For example, a menu bar, a header, a footer, etc… Until now, each of these pages would have had to have their own version of these, and each would have to be updated separately each time the element was changed Much like CSS, SSI is used to centralize global page objects by allowing you to include the objects in a number of different pages

Server Side Includes (cont’d) A server side include tells the browser to take all the text from a file and insert that text where the tag is Think of it like like copying all the text from another file and pasting directly into your html source code A server side include is a directive issued to the server It appears to be a tag, but it is actually different because it is processed by the server, and not the browser This means you cannot test your tags unless your pages are on a server

Server Side Includes (cont’d) The text from the files that include into a webpage should be in html format so that when the final copy is presented to the browser the code is readable You do not need any of the starting tags (such as or in the include file because it is going in the middle of the document and the other file should have them already to begin with The general structure of an SSI tag looks like this: To use SSI in an html page, the page extension must be changed from.html .shtml

Let’s Do An Example! For this example, we’re going to create a very simple webpage that uses SSI We’ll call our webpage: example.shtml We’ll call our include file: includeme.html And the we’ll upload the files onto General: example.shtml into the “public_html” directory includeme.html into the “pages” directory

SSI Example (cont’d) Here is example.shtml

SSI Example (cont’d) Here is includeme. html

SSI Example (cont’d)

SSI Tips 1.Don’t forget to change your extensions to.shtml !!! 2.Don’t forget to change your links to.shtml 3.Don’t forget to remove your old.html pages, especially index.html because otherwise your.shtml page will not show by default 4.Make sure to set the permissions correctly for the include file (-rw-r--r--) 5.Don’t forget that you can’t test your includes until the page is posted to general