Hi,
I have written the following script cgi script called asi.cgi. This scripts reads data from a file and create a simple table. What I would like to add is the possibility to export this table in a file that will be interpreted in Excel. I would like the same script to do both so can I click on an icon (wow_disquette.gif) the cgi will know that the user wants to export to Excel.
My question is can a CGi call itself? Also as I am new to FORMS I am not sure if I did the things correctly. Nothing prints with the command print "variables: $nam, $val\n";
Thanks!
#!/usr/bin/perl
$data_file="asidata.cgi";
open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
$buf = $ENV{'QUERY_STRING'};
@pairs=split(/&/,$buf);
foreach $pair (@pairs) {
($nam,$val) = split(/=/,$pair);
print "variables: $nam, $val\n";
}
print << "HTML";
Content-type: text/html; charset=iso-8859-1
<html>
<head>
<title>OpenWorks Projects General</title>
<script src="/wow/wow_css.js"></script>
<script src="/wow/wow_popupwin.js"></script>
</head>
<body>
<FORM action=" method="get">
<INPUT type="hidden" name="save" value="yes">
<H2>OpenWorks Projects General
<INPUT type=image align=absbottom border=0 src="/wow/images/wow_diskette.gif"></H2>
</FORM>
<table border cellspacing=0.5 cellpadding=1>
<tr>
<th>Project </th>
<th>Last Modified </th>
<th>Last User </th>
<th>Tablespace </th>
<th>External files </th>
<th>Nb SW prj </th>
<th>SW size </th>
<th>Total size </th>
</tr>
<tr>
HTML
foreach $line (@raw_data)
{
chop($line);
($w_name,$last_mod,$last_user,$tblsp,$extf,$nbSW,$SWs,$tot)=split(/ /,$line);
#print"<td><a href=\"# owproj=$w_name\">$w_name</a></td>\n";
if ($w_name ne "PROJECT" ) {
print" <td>$w_name</td>\n";
print" <td>$last_mod</td>\n";
print" <td>$last_user</td>\n";
print" <td>$tblsp</td>\n";
print" <td>$extf</td>\n";
print" <td>$nbSW</td>\n";
print" <td>$SWs</td>\n";
print" <td>$tot</td>\n";
print" </tr>\n";
print" <tr> \n";
}
}
print << "HTML2";
</table>
</body>
</html>
HTML2
I have written the following script cgi script called asi.cgi. This scripts reads data from a file and create a simple table. What I would like to add is the possibility to export this table in a file that will be interpreted in Excel. I would like the same script to do both so can I click on an icon (wow_disquette.gif) the cgi will know that the user wants to export to Excel.
My question is can a CGi call itself? Also as I am new to FORMS I am not sure if I did the things correctly. Nothing prints with the command print "variables: $nam, $val\n";
Thanks!
#!/usr/bin/perl
$data_file="asidata.cgi";
open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
$buf = $ENV{'QUERY_STRING'};
@pairs=split(/&/,$buf);
foreach $pair (@pairs) {
($nam,$val) = split(/=/,$pair);
print "variables: $nam, $val\n";
}
print << "HTML";
Content-type: text/html; charset=iso-8859-1
<html>
<head>
<title>OpenWorks Projects General</title>
<script src="/wow/wow_css.js"></script>
<script src="/wow/wow_popupwin.js"></script>
</head>
<body>
<FORM action=" method="get">
<INPUT type="hidden" name="save" value="yes">
<H2>OpenWorks Projects General
<INPUT type=image align=absbottom border=0 src="/wow/images/wow_diskette.gif"></H2>
</FORM>
<table border cellspacing=0.5 cellpadding=1>
<tr>
<th>Project </th>
<th>Last Modified </th>
<th>Last User </th>
<th>Tablespace </th>
<th>External files </th>
<th>Nb SW prj </th>
<th>SW size </th>
<th>Total size </th>
</tr>
<tr>
HTML
foreach $line (@raw_data)
{
chop($line);
($w_name,$last_mod,$last_user,$tblsp,$extf,$nbSW,$SWs,$tot)=split(/ /,$line);
#print"<td><a href=\"# owproj=$w_name\">$w_name</a></td>\n";
if ($w_name ne "PROJECT" ) {
print" <td>$w_name</td>\n";
print" <td>$last_mod</td>\n";
print" <td>$last_user</td>\n";
print" <td>$tblsp</td>\n";
print" <td>$extf</td>\n";
print" <td>$nbSW</td>\n";
print" <td>$SWs</td>\n";
print" <td>$tot</td>\n";
print" </tr>\n";
print" <tr> \n";
}
}
print << "HTML2";
</table>
</body>
</html>
HTML2