CGI.pm Tutorial. Table of content. What is CGI? First Program



Similar documents
CGI Programming. What is CGI?

Internet Technologies

Customizing Confirmation Text and s for Donation Forms

ICT 6012: Web Programming

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Introduction to XHTML. 2010, Robert K. Moniot 1

CS412 Interactive Lab Creating a Simple Web Form

<option> eggs </option> <option> cheese </option> </select> </p> </form>

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Inserting the Form Field In Dreamweaver 4, open a new or existing page. From the Insert menu choose Form.

How to Create an HTML Page

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS COPYRIGHT 2013 TERRY ANN MORRIS, ED.D

Further web design: HTML forms

Viewing Form Results

Perl/CGI. CS 299 Web Programming and Design

HTML Forms and CONTROLS

With tags you can create italic or bold characters, and can control the color and size of the lettering.

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

Web Development 1 A4 Project Description Web Architecture

By Glenn Fleishman. WebSpy. Form and function

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

07 Forms. 1 About Forms. 2 The FORM Tag. 1.1 Form Handlers

Short notes on webpage programming languages

HTML Tables. IT 3203 Introduction to Web Development

XHTML BASICS. Institute of Finance Management CIT Department Herman Mandari

How to Manage Your Eservice Center Knowledge Base

Working with forms in PHP

Website Planning Checklist

Designing and Implementing Forms 34

HTML Forms. Pat Morin COMP 2405

Creating HTML authored webpages using a text editor

So we're set? Have your text-editor ready. Be sure you use NotePad, NOT Word or even WordPad. Great, let's get going.

Introduction Designing your Common Template Designing your Shop Top Page Product Page Design Featured Products...

How to Make a Working Contact Form for your Website in Dreamweaver CS3

Introduction to Web Design Curriculum Sample

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Tutorial 6 Creating a Web Form. HTML and CSS 6 TH EDITION

Web Design and Development ACS Chapter 13. Using Forms 11/30/2015 1

XHTML Forms. Form syntax. Selection widgets. Submission method. Submission action. Radio buttons

Google Sites: Site Creation and Home Page Design

Basic Website Maintenance Tutorial*

XCM Internet Explorer Settings

2- Forms and JavaScript Course: Developing web- based applica<ons

Forms, CGI Objectives. HTML forms. Form example. Form example...

TCP/IP Networking, Part 2: Web-Based Control

ITNP43: HTML Lecture 4

Your First Web Page. It all starts with an idea. Create an Azure Web App

Lab 1.3 Basic HTML. Vocabulary. Discussion and Procedure

USING MYWEBSQL FIGURE 1: FIRST AUTHENTICATION LAYER (ENTER YOUR REGULAR SIMMONS USERNAME AND PASSWORD)

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Dreamweaver Tutorials Creating a Web Contact Form

The Web Web page Links 16-3

Real SQL Programming 1

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

understand how image maps can enhance a design and make a site more interactive know how to create an image map easily with Dreamweaver

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

Dynamic Web-Enabled Data Collection

Sage Accpac ERP 5.6A. CRM Analytics for SageCRM I User Guide

Web Design with Dreamweaver Lesson 4 Handout

Accessibility in e-learning. Accessible Content Authoring Practices

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

FACULTY OF COMMERCE, OSMANIA UNIVERSITY

Starting User Guide 11/29/2011

A send-a-friend application with ASP Smart Mailer

HTML, CSS, XML, and XSL

About webpage creation

Formatting Text in Blackboard

The Basics of Dynamic SAS/IntrNet Applications Roderick A. Rose, Jordan Institute for Families, School of Social Work, UNC-Chapel Hill

Website Development Komodo Editor and HTML Intro

FORMS. Introduction. Form Basics

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Contents. Downloading the Data Files Centering Page Elements... 6

Advanced Drupal Features and Techniques

Upload Center Forms. Contents. Defining Forms 2. Form Options 5. Applying Forms 6. Processing The Data 6. Maxum Development Corp.

LAB MANUAL CS (22): Web Technology

Basic tutorial for Dreamweaver CS5

An Attribute is a special word used inside tag to specify additional information to tag such as color, alignment etc.

Interaction between browser and server. HTML (Hyper Text Markup Language)

Creating your personal website. Installing necessary programs Creating a website Publishing a website

Website Builder Overview

Form And List. SuperUsers. Configuring Moderation & Feedback Management Setti. Troubleshooting: Feedback Doesn't Send

How to code, test, and validate a web page

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

CREATING WEB PAGES USING HTML INTRODUCTION

CGI Programming. Examples

Step by step guides. Deploying your first web app to your FREE Azure Subscription with Visual Studio 2015

7 Why Use Perl for CGI?

Creating a Resume Webpage with

picocms Client Training - A pico-cms.com

JavaScript and Dreamweaver Examples

10.1 The Common Gateway Interface

Using Form Tools (admin)

Transcription:

CGI.pm Tutorial This is a tutorial on CGI.pm which include scripts to let you see the effects. CGI.pm is a Perl module to facilitate the writing of CGI scripts. Click here to see the details. This tutorial assumes you have a basic knowledge of Perl and HTML. Table of content What is CGI? First program Redirection Request Unpaired Tags Paired Tags Text Field in CGI Form Pop Up Menu in CGI Form Checkbox and Radio Button in CGI Form What is CGI? The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers, such as HTTP or Web servers. A plain HTML document that the Web server delivers is static, which means it doesn t change. A CGI program, on the other hand, is executed in real-time, so that it can output dynamic information - perhaps a weather reading, or the latest results from a database query. [ Table of Content ] First Program The first program just invokes Perl and uses CGI.pm to the title and heading of the web page. start_html( This is the title ), h1( This is the heading ); The first line specifies where the perl interpreter is.

The second line includes the CGI Perl module and use standard symbols. The third line s the HTML header (text/html by default). The fourth and fifth line s the HTML title and heading. start_html( This is the title ), h1( This is the heading ); The last line ends the HTML document by ing the </BODY> and </HTML> tags. Redirection Request This program generates a redirection request for the remote browser. redirect( http://home.school.net.hk/~hywong/redirect.html ); It will immediately go to the indicated URL, here is, http://home.school.net.hk/~hywong/redirect.html Absolute URLs should be used in redirection requests. Relative URLs will not work correctly. Unpaired Tags This program reveals the use of unpaired tags including <BR>, <P> and <HR>. start_html(-title=> This is the title, -BGCOLOR=> green ); ( This is the first line. ); br; ( This is the second line. );

( This is the second paragraph ); ( The background color of this page is GREEN ) This lines out the title of the document and set the background color to green. start_html(-title=> This is the title, -BGCOLOR=> green ); This line s out the text "<br>". Print br; This line s out the text "<p>". Print p; This line s out the text "<hr>". Print Paired Tags This program reveals the use of paired tags including <H1>, <B>, <UL> and the like. start_html(-title=> Paired Tags, -BGCOLOR=> yellow ); h1( The Use of Paired Tags ); br; ( This is an, i( italic ), word. ); ul( li( 1st item of an unordered list ), li( 2nd item of an unordered list ), li( 3rd item of an unordered list ) ); ( The background color of this page is, em( YELLOW )); a(href=>"http://www.school.net.hk/~hywong/cgipmtut.html#pair_tag", GO BACK ); This line creates the text "<h1>the Use of Paired Tags</h1>".

h1( The Use of Paired Tags ); This line creates the text "This is an <i>italic</i> word.". ( This is an, i( italic ), word. ); This line s out the text: <ul> <li>1st item of an unordered list <li>2nd item of an unordered list <li>3rd item of an unordered list </ul> ul( li( 1st item of an unordered list ), li( 2nd item of an unordered list ), li( 3rd item of an unordered list ) ); This line creates the text "The background color of this page is <em>yellow</em>". ( The background color of this page is, em( YELLOW )); This line creates the text "<a href="http://www.school.net.hk/~hywong/cgipmtut.html#pair_tag>go BACK</a>". a(href=>"http://www.school.net.hk/~hywong/cgipmtut.html#pair_tag", GO BACK ); Text Field in CGI Form This program create a CGI form with text fields. start_html( CGI Form with Text Field ); h1( CGI Form with Text Field ); start_form; "What is your name?"; textfield(-name=> field_name, -size=>30); "What is your comment?"; textarea(-name=> large_field_name, -rows=>10, -columns=>50); submit;

end_form; "Your name is ", param( field_name ), p, "Your comment is: ", param( large_field_name ), a(href=> http://www.school.net.hk/~hywong/cgipmtut.html#text_field, Go Back ); This line is used to start a CGI form by creating the <form> tag. start_form; These lines create a text field of 30 characters. The name of this text field is "field_name". textfield(-name=> field_name, -size=>30); These lines create a large text field with 10 rows and 50 columns. The name of this text field is "large_field_name". textarea(-name=> large_field_name, -rows=>10, -columns=>50); This line creates the submit button. submit; This line is used to end a CGI form by creating the </form> tag. end_form; These lines handle the information submitted. "Your name is ", param( field_name ), p, "Your comment is: ", param( large_field_name ), Pop Up Menu in CGI Form

This program create a CGI form with pop up menu. start_html( CGI Form with Pop Up Menu ); h1( CGI Form with Pop Up Menu ); start_form; "What is your favourite color?"; popup_menu(-name=> color, -values=>[ red, orange, yellow, green, blue, indigo, violet ], -default=> blue ); submit(-name=> submit button ); ; reset; end_form; "Your favourite color is ", param( color ), a(href=> http://www.school.net.hk/~hywong/cgipmtut.html#pop_up_menu, Go Back ); This line creates a pop up menu of seven values, while "blue" is the default value. popup_menu(-name=> color, -values=>[ red, orange, yellow, green, blue, indigo, violet ], -default=> blue ); This line creates the submit button, with "submit button" as its name. submit(-name=> submit button ); This line creates the reset button. reset; Checkbox and Radio Button in CGI Form This program create a CGI form with checkboxes and radio buttons.

start_html( CGI Form with Pop Up Menu ); h1( CGI Form with Pop Up Menu ); start_form; "What is your favourite color?"; checkbox_group(-name=> color, -values=>[ red, orange, yellow, green, blue, indigo, violet ], -default=>[ red, blue ]); radio_group(-name=> color blind, -values=>[ Yes, No ], -default=> No ); submit(-name=> submit button ); ; reset; end_form; "Your favourite color: ", param( color ), p, "Color blind? ---> ", param( color blind ), a(href=> http://www.school.net.hk/~hywong/cgipmtut.html#checkbox, Go Back ); These lines create seven checkboxes, with "red" and "blue" as the default values. checkbox_group(-name=> color, -values=>[ red, orange, yellow, green, blue, indigo, violet ], -default=>[ red, blue ]); These lines create two radio buttons, with "No" as the default value. radio_group(-name=> color blind, -values=>[ Yes, No ], -default=> No ); This page is brought to you by Wong Ho Yiu Castor. Created on 24th August, 1997. Last modified on 30th August, 1997.