• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20

3ISE517 Internet Application Programming - CGI

Extracts from this document...


Coursework for:

Internet Application Programming






Introduction        3                

Basic HTTP Requests        5

Using the Common Gateway Interface        

        Basic Overview of the use of CGI        6

        Explanation of how CGI is used        7

References        9

Appendix A:

        Program listing of HTML Form        12

        Program listing of CGI Script        14        

Appendix B:

        Screenshots of validation performed by CGI Script        16

Appendix C:

        Additional Features         18


        Every time we request a web page on our browser, the browser would have created a connection with a web server, sent a request and received the required page before displaying it on our screens. A basic representation of such a request in shown in the diagram below:


[Reference: http://computer.howstuffworks.com/web-server1.htm, 23/11/08]

        Generally pages requested by web browsers are static web pages which would be held in the web server’s local repository.  All the web server has to do is, locate the requested web page and return it to the browser. What one means by a static web page is that its content does not change until its owner modifies it.

        But some applications or scenarios require information not from pages that have been pre-written but from pages that are generated based on user input. For example, when searching for an article on the web, the results are generated based on the search words entered by the user. Such web pages are known to be generated dynamically.

...read more.



How CGI Scripting Works - Forms: Sending Input


How CGI Scripting Works - Summary


Common Gateway Interface


The Client-Server Architecture


Web and Database Integrating Using CGI




How CGI Scripting Works - The CGI Mechanism


Web Server




        Program listings of Form.html


Written by : Malshani Nanayakkara

StudentID: 2007020



<head><title>HTML Form</title></head>

<body bgcolor="#ADDFFF">

        <font color="blue">

        <h2><center>Welcome to</center></h2>

        <h2><center>Online Surveys</center></h2>

        <p align=center><b>Hi, we are conducting a survey to see which is currently the popular drink in the country.<br/>

        If you are between the ages of 14 and 50, we kindly request just a minute of your time to fill out the form below.</b></p></font>

        <br />

        <form method=POST ACTION="http://localhost/cgi-bin/mycgi.pl">

...read more.




- reads from the text file and displays survey results

Using this text file, the survey results can be viewed:


The page that mycgi,pl returns, contains a button which runs another script which will read the file and display the survey results.

And a page like the one below will be generated:


 A program listing for the survey.pl file is given below:

Program listing of survey.pl


use CGI qw(:standard);

print "Content-type: text/html\n\n";

print "<html><head><title>CGI Scripting Results</title></head>";

print "<body bgcolor=\"#ADDFFF\"><font color=\"blue\"><br/>";

open(INFILE, 'survey_results.txt');

@drinks=("Soda", "Pepsi", "Sprite", "Fanta", "Ginger Beer", "Cream Soda", "Portello", "Coca-Cola", "Fruit Juices", "Water");

@drinks_score=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

while ($line=<INFILE>)        #reads file line by line


        ($name, $age, $email, $survey) = split(/\t/, $line);        #seperates each line into seperate data

        $survey =~s/\+/ /;        #if the drink has two words, the '+' sign will be replaced by a space


        while ($i<10)



                {        $drinks_score[$i]++;        }                #the line is compared with an array containing all the drinks




print "<br/><font size=\"+1\"><b> Survey Results:</b></font><br/><br/>";


while ($i<10)


        print "<b> $drinks[$i]</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$drinks_score[$i]";

        print "<br/>";



print "</body></html>";

...read more.

This student written piece of work is one of many that can be found in our University Degree Software Engineering section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related University Degree Software Engineering essays

  1. Programming Concepts. Andora Video is a small shop selling videos. The owner, Raul, wishes ...

    subtotal for a video title double vdSubtotalAll Holds calculated subtotal for all video titles double dSubtotal Holds calculated subtotal of all the videos after relevant discount has been taken off double discount Holds the relevant discount depending upon the whole video quantity order double total Holds calculated total of whole

  2. MS Office solutions. Fantasy mobiles require: ...

    2.4 Functional Testing Test No. Test Details Expected Result Actual Result 1. Click 'Show' Button Clicking of the 'Show' button should display all the model numbers in the list box Pass 2. Select item in list box The item within the list box should now display within the 'Model' textbox Pass 3.

  1. 3SFE504 - Object Oriented Programming - Linear and Independent Hash Table code

    { dic=dic-TABLE_SIZE; } if(dictionary[dic].word==word) { dictionary[dic].word=word; dictionary[dic].defList.insertAtHead(def); t++; } }while(dictionary[dic].word!="" && main!=dic); if(t==0) { dictionary[dic].word=word; dictionary[dic].defList.insertAtHead(def); } } } List LinHTable::get(string w) { int key=HashVal(w); while(dictionary[key].word!=w) { key++;// key is represents increment to be used . } return dictionary[key].defList; } void LinHTable::traverse()

  2. Complete Section 2 of 3

    Sybase ASE Express Edition for Linux is the first enterprise-class commercial database that can take you from pilot to deployment for zero dollars and zero risk. As an enterprise-class data management platform, you can manage growth and evolving requirements without painful, expensive upgrades. I would consider SQL for administrative purposes.

  1. Complete Section 3 of 3

    The number of each type of training session is determined, based on the number of personnel to be trained and the desirable size of each session. A schedule for performing the training is worked out, according to the availability of the participants, the instructors and the training facilities.

  2. Rich Internet Applications

    'Unlike traditional applications software installation is not required' [http: 1]. Depending on the machine that is being used to view the RIA however might need Activex, Flash, Java or a similar plug-in installed. There are many different types of RIA development packages available.

  1. Evaluating Websites Usability - comparing 5 websites.

    There is no buy function; I gather that an email has to be sent to show interest in a certain book. Other Useful Information: 1. “”© Copyright of all poems remain with the poets.” & “© Photos of Leeds courtesy of Leeds Library and Information Service” is the only useful information I can find on this website.

  2. Abstract This report is dedicated to demonstrating and critically reviewing new features and developments ...

    Center, Problem Reports and Solutions, Windows Defender, Windows Update, Network Access Protection, Backup and Restore, User Account Control, and more. So instead of a bunch of different parts of the system trying to alert you in their own unique ways, messages will all come from the same place, and be made available via the new Action Center tray icon [10].

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work