Passing data in cgi

2,218 views
2,162 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,218
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Passing data in cgi

  1. 1. Sending Data CISIWEB 430A
  2. 2. Objectives <ul><li>In this unit, you will </li></ul><ul><ul><li>Create a hyperlink to a CGI script </li></ul></ul><ul><ul><li>Append data to a URL </li></ul></ul><ul><ul><li>Use the CGI.pm module to parse data </li></ul></ul><ul><ul><li>Access data using the param function </li></ul></ul>
  3. 3. print Function <ul><li>Used to send output to a location </li></ul><ul><ul><li>Syntax: print output; where output is some information you want to see displayed </li></ul></ul><ul><ul><li>The output can be an expression or several expressions separated by commas. These expressions can be literal values, variables, or even functions </li></ul></ul>
  4. 4. Passing data through a hyperlink <ul><li>Syntax: <A HREF=”URL? key=value ”>hyperLinkText</A> </li></ul><ul><li>Key and value should both be one word </li></ul><ul><ul><li>If not, you have to use the “+” symbol instead of spaces </li></ul></ul>
  5. 5. Parsing Data <ul><li>Once you pass information to a script, you parse the information (or process) </li></ul><ul><li>Parsing routines are already written </li></ul><ul><ul><li>CGI.pm (.pm stands for perl module) </li></ul></ul><ul><ul><li>We only need the standard portion of the module </li></ul></ul><ul><ul><li>To use a module, use CGI </li></ul></ul><ul><ul><li>Use CGI (“:standard”);, or use CGI qw(:standard); </li></ul></ul><ul><ul><ul><li>qw stands for ‘quote word’ </li></ul></ul></ul><ul><ul><ul><li>qw is used in place of quotations, more widely used than the quotation marks </li></ul></ul></ul>
  6. 6. Getting the data <ul><li>By using the CGI.pm module, we are already parsing the data </li></ul><ul><li>Once the data is parsed, it can be accessed through the key </li></ul><ul><ul><li>Perl uses the param function </li></ul></ul><ul><ul><li>Syntax:param (key) </li></ul></ul><ul><li>Sending multiple items of data </li></ul><ul><ul><li>Separate key/value pairs with an ampersand (&) </li></ul></ul>

×