University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
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?
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
CGI Programming.
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
CGI Programming Part 2. Input Tags Many different ways of getting data from the user. The tag is used most often. has a type attribute –Specifies the.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Tutorial 6 Working with Web Forms
CGI Programming in Perl Software Tools. Lecture 22 / Slide 2 CGI Programming l Last time we looked at designing a static web page. Today we will see how.
CGI programming in Perl Learning Objectives: 1. To understand how a CGI program works in Perl and how to make it runnable in web browsers 2. To learn how.
Python and Web Programming
Guide To UNIX Using Linux Third Edition
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Forms and Form Controls Chapter What is a Form?
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
INE1020 Introduction to Internet Engineering Tutorial 8 All about Lab 6.
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
Perl Web Page – Just Enough Pepper. Web site Set up the top of your script to indicate perl and plain text #!/usr/bin/perl print "Content-type:text/plain\n\n";
Python CGI programming
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
CSU - DCE Advanced Perl CGI Operation - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) on the.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
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.
1 Basic Perl CGI Programming. 2 Issues How and when your program is invoked. Generating Response –HTTP Headers –HTML (or whatever document type you want)
Chapter 6 Server-side Programming: Java Servlets
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.
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.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
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,
JavaScript - A Web Script Language Fred Durao
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.
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) Instructor: Joseph DiVerdi,
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
World Wide Web Components Browsers and Servers CGI Processing Model (Common Gateway Interface) © Norman White, 2001.
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.
PHP Form Processing * referenced from
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Informatics Computer School CS114 Web Publishing HTML Lesson 4.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
Chapter 7 - Introduction to Common Gateway Interface (CGI)
CGI I: Basics Web Programming.
Section 17.1 Section 17.2 Add an audio file using HTML
CGI Programming Part II UNIX Security
CGI I: Basics Web Programming.
Presentation transcript:

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies Dr. Susan Gauch

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C CGI – Common Gateway Interface An html web page is static (unchanging) –Text document sent from server to browser CGI program creates dynamic information –Program is executed upon demand –Generates fresh content for each request

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C CGI Overview Developer creates an HTML page with a on it –Specifies the name of the program –Names some variables that can hold data User enters information into the Web page (fills in the variables in the and clicks Browser send the information to the URL

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C CGI Overview continued Server unpacks the HTTP message –Finds the name of the program to call –Finds the data Server calls the program and passes in the data Program generates output and writes it to “standard out” (the screen, usually) Server takes the output and passes it along to the browser Browser displays the output on the user’s screen

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Forms Forms are part of regular HTML documents There may be more than one form in a document Forms may not be nested …

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C INPUT Forms receive input from the user Each input area has its own name and type of input it may receive Forms may receive input from –Text –Radio –Checkbox –Submit –Reset –Password

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Submitting Information via a FORM When SUBMIT is pushed, the contents of the form get sent to the server in the form: programname?var1=value1&var2=value2 You may send the data via POST or GET –You choose this when you write the HTML page with the FORM in it

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C POST and GET POST –cgi program reads from stdin (I.e., the keyboard) –No limit on the amount of data sent GET –Cgi program reads from an environment variable (QUERY_STRING) –Limit on length of data sent (1,000? Characters?) Recommend that you use POST

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C A Simple Perl Program tiny.pl #!/usr/bin/perl use strict; # compile time checking use warnings; # runtime checking my $username; # declare the variable print "What is your username? "; # print out the question $username = ; # ask for the username chomp($username); # remove "new line" print "Hello, $username.\n"; # print out the greeting

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Making It a CGI program tinyPL.cgi #! /usr/bin/perl use strict; use warnings; use CGI qw(:standard); my $username; $username = "Susan"; print header(); print start_html("First CGI program"); print "Hello $username.\n"; print end_html();

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Calling it from a Web Page <A HREF= " Call tinyPL.cgi

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C What the Web Page Looks Like Call tinyPL.cgi

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Reading Parameters in a CGI adduserPL.cgi #!/usr/bin/perl use strict; use CGI qw(:standard); my $cgiform = new CGI; my $username = $cgiform->param("username"); #Gets values from form my $password = $cgiform->param("password"); print header(); print start_html("Add a User"); print " Username: $username \n"; print " Password: $password \n"; print end_html();

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Form to Call adduserPL.cgi <FORM ACTION= " METHOD="POST"> Become a Registered Customer

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Form to Call adduserPL.cgi continued Choose your username: Choose your password:

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C What It Looks Like Choose your username: Choose your password: Add Me Become a Registered Customer

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Creating CGI programs First step Create a program that runs from the command line Put the program in your.public_html/cgi-bin directory Set the variables in the program e.g., $username = “sgauch”; Save the output to a file Perl myprog.cgi > output.html View the file in a browser (remove top two lines first) Second step Have a friend login and run your program from their directory e.g., perl /users/myusername/.public_html/cgi-bin/myprogram.cgi > output

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Creating CGI programs continued Third step Design a form that calls a dummy cgi That cgi should just print out “hello world” Put the form in your.public_html directory View the form in the browser Click submit Check that you see “hello world” Fourth step In your perl program, comment out all parts of the program Just print the parameters to confirm you’re getting them Call this program from the form Fifth step Remove comments and test the REAL progrram

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Debugging CGI programs - Permissions problems -inadequate permissions -Test this by having someone besides yourself execute the code -Do and ls –l on the directory structure -It should be drwxr-wr-x on all directories -Chmod 755 my directory -Chmod 644 for your perl program -Path problems -Test this by creating and calling a really simple cgi program -Invalid HTML produced -Call this and save output to a file -View file in a browser

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Common Problems #!/usr/bin/perl must be the first line in the file Even before any other comments Remember to call the print header() function It must occur before any other print statements On some systems, the filename must end.cgi not.pl

University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Useful Links –JumpStart to the Web Technologies –History of the Internet and Web W/HTMLPrimerAll.htmlhttp://archive.ncsa.uiuc.edu/General/Internet/WW W/HTMLPrimerAll.html –A thorough description of HTML tags –A good tutorial on CGI programming