Full RELEVANT code
sub Load()
{
#Get OrderNo for filename
open(INFILE,"$ENV{'DOCUMENT_ROOT'}/compaq/orderno.dat"

or die "Can not open KPorderNo data file";
$orderno = <INFILE>;
close(INFILE);
#Check for data file
$file = "$ENV{'DOCUMENT_ROOT'}/compaq/orders/$orderno.dat";
unless(-e $file)
{
#Move order number on
open(INFILE,">$ENV{'DOCUMENT_ROOT'}/compaq/orderno.dat"

or die "Can not open KPorderNo data file";
$neword = sprintf("%06d",$orderno+1);
print INFILE "$neword";
close(INFILE);
}
#check referer
$refer = $query->param("From"

;
if ($refer eq "recert"

{
$Prodtemplate = "$ENV{'DOCUMENT_ROOT'}/compaq/products/products.data";
}
elsif ($refer eq "ilp"

{
$Prodtemplate = "$ENV{'DOCUMENT_ROOT'}/compaq/products/ilp.data";
}
else
{
#redirect????
die "Where the hell did you come from???"
}
open(PROD,"$Prodtemplate"

or die "Can not open products file";
$a = 1;
while ($line = <PROD>)
{
($prodcode[$a], $prodname[$a], $webcode[$a]) = split /;/, $line;
$a++
};
close(PROD);
open(PRICE,"$ENV{'DOCUMENT_ROOT'}/compaq/kpplfcr/plrc.dat"

or die "Can not open recert price file";
$p = 1;
while ($line = <PRICE>)
{
($accno[$p], $pricel[$p], $pricem[$p], $priceh[$p]) = split /;/, $line;
$p++
};
close(PRICE);
open(ILPPRICE,"$ENV{'DOCUMENT_ROOT'}/compaq/kpplfcr/ilppl.dat"

or die "Can not open ilp price file";
$q = 1;
while ($line = <ILPPRICE>)
{
($accno[$q], $price[$q]) = split /;/, $line;
$q++
};
close(ILPPRICE);
};
****************
Calc sub HIDDEN STUFF
open(DATFILE,">$ENV{'DOCUMENT_ROOT'}/compaq/orders/$orderno.dat"

or die "Can not open Order Data file";
@names = $query->param;
foreach $name (@names)
{
$kitprice = "";
$unitprice = "";
if ($name =~ /....SSK/)
{
if ($query->param($name) > 0)
{
if ($query->param($name) < 21)
{
$kitprice = $query->param($name) * $phigh;
$unitprice = "£$phigh";
}
elsif ($query->param($name) < 51)
{
$kitprice = $query->param($name) * $pmed;
$unitprice = "£$pmed";
}
else
{
$kitprice = $query->param($name) * $plow;
$unitprice = "£$plow";
}
#Store variables
$quantity = $query->param($name);
print DATFILE "$name;$quantity;$kitprice;$unitprice;";
print DATFILE "\n";
$b = 1;
while ($b < $a)
{
if ($webcode[$b] eq $name)
{
$code = $prodcode[$b];
$name = $prodname[$b];
}
$b++;
}
$table .= "<tr><td class=\"ul\" align=\"left\">$name</td><td class=\"ul\" align=\"center\" width=\"60\"><b>$unitprice</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>$quantity</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>£$kitprice</b></td></tr>";
$hiddendata .= "<input type=\"hidden\" name=\"$name\" value=\"$quantity\">";
}
}
if ($name =~ /....RET/)
{
if ($query->param($name) > 0)
{
$kitprice = $query->param($name) * 30.00;
$unitprice = "£30";
#Store variables
$quantity = $query->param($name);
print DATFILE "$name;$quantity;$kitprice;$unitprice;";
print DATFILE "\n";
$b = 1;
while ($b < $a)
{
if ($webcode[$b] eq $name)
{
$code = $prodcode[$b];
$name = $prodname[$b];
}
$b++;
}
$table .= "<tr><td class=\"ul\" align=\"left\">$name</td><td class=\"ul\" align=\"center\" width=\"60\"><b>$unitprice</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>$quantity</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>£$kitprice</b></td></tr>";
$hiddendata .= "<input type=\"hidden\" name=\"$name\" value=\"$quantity\">";
}
}
if ($name =~ /....ILP/)
{
if ($query->param($name) > 0)
{
$kitprice = $query->param($name) * $price;
$unitprice = "£$price";
#Store variables
$quantity = $query->param($name);
print DATFILE "$name;$quantity;$kitprice;$unitprice;";
print DATFILE "\n";
$b = 1;
while ($b < $a)
{
if ($webcode[$b] eq $name)
{
$code = $prodcode[$b];
$name = $prodname[$b];
}
$b++;
}
$table .= "<tr><td class=\"ul\" align=\"left\">$name</td><td class=\"ul\" align=\"center\" width=\"60\"><b>$unitprice</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>$quantity</b></td><td class=\"ul\" align=\"center\" width=\"60\"><b>£$kitprice</b></td></tr>";
$hiddendata .= "<input type=\"hidden\" name=\"$name\" value=\"$quantity\">";
}
}
}
close(DATFILE);
};
There is more to the beginnig of the second sub but I can't post it here im afraid
