CGI and Perl - Basics Please use speaker notes for additional information!
-
Upload
lee-bishop -
Category
Documents
-
view
225 -
download
0
Transcript of CGI and Perl - Basics Please use speaker notes for additional information!
CGI and Perl - Basics
Please use speaker notes for additional information!
Note that the param(‘dept’) could have been written as param(“dept”).
I put the dept.html code and the spruce.gif image in the begin subdirectory/folder under the public_html directory/folder. Note that I mirror the setup on my hard drive to help me keep a structure to what I am doing.
I put the dept.cgi in the begin subdirectory/folder under the cgi-bin directory/older.
<!spemp.html><html><head><title>Spruce Department Store</title></head><body><div align=center><h1>Spruce Department Store</h1><img src="spruce.gif"><br><br></div><h2>Select an employee to get more information:</h2><font size=4><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=John+Smith&title=clerk">Smith</a><br><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=Susan+Ash&title=manager">Ash</a><br><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=Donald+Costa&title=accountant">Costa</a><br><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=Jane+Anderson&title=clerk">Anderson</a><br><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=Patricia+Sousa&title=buyer">Sousa</a><br><a href="http://www.pgrocer.com/cgi-bin/begin/spemp.cgi?emp=Robert+Parker&title=supervisor">Parker</a><br></font></body></html>
#!/usr/bin/perl#another example of cgi and perlprint "Content-type: text/html\n\n";use CGI qw(:standard);print "<html>\n";print "<head><title>Spruce Department Store</title><basefont size=4></head>\n";print "<body>\n";print "<h1>Employees of Spruce Department Store</h1>\n";print "Employee: ", param('emp'), " Title: ", param('title'), "\n";print "</body>\n";print "</html>\n";