Introduction
This tutorial provides a handy resource for everything you need to know to make and keep cgi scripts running,using PERL, the World's friendliest language.Forms in HTML
Forms in HTML, contain fields whose values are
to be
Most commonly cited usage of these forms is to collect
The structure of the form tag is as follows:
< form Name="first" Method="GET" action="/cgi-bin/xyz.cgi">
< /form>
The 'Name' attribute of the form is optional and is used
The 'Method' attribute can contain a value of 'GET'
or
The value of the 'Action' attribute specifies which
cgi
The contents inside the < form> and < /form> could
be
Text Input: < input type="text" name='anyname' value='ifany'> which shows up on the browser like this Password Input : < input type="password" name='pass' value='ifrequired'>
which shows up like this
Submit : < input type="Submit" value='Submit Form'>
which produces an output like this and submits
Reset :
< input type="reset" Value="Clear">
which produces an output like this and resets / clears
These are the basics you need to know to handle 'forms'
The
work of the CGI Scripts start once the form elements
The form elements are rendered
in the form of
'cgi-lib.pl'
This module written
by Mr. Steven.E.Brenner is
Let us
now see an example, of how the tasks about which
Client Side
Customer Detail's Collection Form
This is how the HTML form looks at the client side,
< html> < head> < title> Customer details collection form< /title> < /head> < body> < FORM Name="FirstTrial" METHOD="POST"
Action= "cgi-bin/demo.cgi">
Enter the Name : < input type="text" name="name">
Enter your age : < input type="text" name="age">
< input type="Submit">
< /FORM> < /body>
< /html>
Server Side
At the server side this data reaches in the following
" name=The+name+you+typed&age=31 "
Notice how the spaces are transformed into '+' Symbols.
1. require "cgi-lib.pl";
Line 1 : Includes the "cgi-lib.pl" module into the perl
Line 2 : Calls the subroutine ' ReadParse '.
Line 3 : The value of the variable 'Name' is stored in the
Line 4 : The value of the variable 'Age' is stored in the
This
brings us to the end of the
introductory section.
|