Kaye and Geoff's web page documentation 

Perl script to return unformatted data passed from a form

The following Perl code returns a web page containing the information (unchanged) which it received from the form which invoked it. The string from the form is assigned to the variable $incoming from the predefined file handle STDIN. Anything written to standard output goes back to the browser, so the script uses PRINT statements to first output the MIME type (note followed by two line terminators) and then some basic HTML to display a web page containing the string.

#!/usr/bin/perl # # cgi_string.pl receives a request from www passing any number of fields # and passes back the data unchanged, to show what it received # $incoming = <STDIN>; print "Content-type: text/html\n\n"; print '<html><body bgcolor="#ffffff">' . "\n"; print '<b>The data passed to the CGI was:</b><br><br>' . "$incoming\n"; print '<hr>' . "\n"; print '</body></html>'; exit;
Top
Close