I've tried one of your ideas above and come to the conclusion that this is absolutely crazy and unexplainable. I've attached the original script below and I've amended it to execute a new script called test.cgi once the form has been submitted (ignore all the commenting out in the 'adddetails' subroutine - this bit is still in the testing stage). I've also attached the test.cgi script.
If you run the original script as it is you will notice that it passes all the parameters. If you run it with the ENCTYPE parameter included you will notice that it doesn't pass anything.
I'm bloody flummoxed!!!
### Original script ###
#!/usr/bin/perl
########################################################################
# #
# ADMIN_ADD.CGI (developed for
#
# Copyright 2003 Dotquake Web Services, all rights reserved #
# Web:
Email: info@dotquake.com #
# #
# This program is provided for sole use on the web site for which it #
# was developed and must not be used elsewhere or redistributed in any #
# form without the express permission of the copyright holder #
# #
# Version history: #
# 1.0 - 02/01/03: Conception #
# #
########################################################################
$stockfile = "../htdocs/vstock.dat";
$vmakesfile = "../htdocs/vmakes.dat";
$reffile = "../htdocs/reference.dat";
print "Content-type: text/html\n\n";
if ($ENV{'REQUEST_METHOD'} eq "GET"

{
@argpairs = split(/&/, $ENV{'QUERY_STRING'});
}
else
{
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@argpairs = split(/&/, $buffer);
}
foreach $dataline (@argpairs)
{
($argname, $argvalue) = split(/=/, $dataline);
$argvalue =~ tr/+/ /;
$argvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$argvalue =~ s/<!--(.|\n)*-->//g;
$argvalue =~ s/<([^>]|\n)*>//g;
$form{$argname} = $argvalue;
}
if ($form{scriptaction} eq "adddetails"

{
&adddetails;
}
open (REFFILE, "$reffile"

;
@reffile = <REFFILE>;
close (REFFILE);
foreach $dataline (@reffile)
{
chomp $dataline;
($reference) = split(/\|/, $dataline);
}
$reference = sprintf("%04d", $reference);
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
print "<meta name=\"Author\" content=\"Dotquake Web Services - info\@dotquake.com\">\n";
print "<meta name=\"Description\" content=\"MN Car Sales - Pre-owned cars from £300 upwards\">\n";
print "<meta name=\"Keywords\" content=\"car, sales, warranty, part exchange, bodywork repair, valet\">\n";
print "<link rel=\"stylesheet\" href=\"../style.css\" type=\"text/css\">\n";
print "<script language=\"Javascript\" src=\"../admin_add.js\" type=\"text/javascript\"></script>\n";
print "<title>MN Car Sales</title>\n";
print "</head>\n";
print "<body bgcolor=\"#F0F8FF\" onLoad=\"document.forms.add.make.focus()\">\n";
print "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\" background=\"../background.jpg\">\n";
print "<tr>\n";
print "<td width=\"1%\" valign=\"top\" nowrap><img border=\"0\" src=\"../spacer.gif\" width=\"8\" height=\"8\"><img border=\"0\" src=\"../spacer.gif\" width=\"8\" height=\"8\"><img border=\"0\" src=\"../mncslogo.gif\" alt=\"MN Car Sales\" width=\"148\" height=\"77\"></td>\n";
print "<td width=\"99%\" align=\"right\" valign=\"top\"><p><b><font face=\"Verdana, Arial\" size=\"3\">· Pre-owned cars from £300 upwards<br>· Finance & warranties available<br>· Part exchanges welcomed<br>· All types of vehicle purchased for cash</font></b></p></td>\n";
print "</tr>\n";
print "</table>\n";
print "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
print "<tr>\n";
print "<td colspan=\"4\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"center\" valign=\"top\" nowrap background=\"../menubarback.jpg\">\n";
print "<p><font face=\"Verdana, Arial\" size=\"1\"><b>SITE MENU</b><br><br></font>\n";
print "<font face=\"Verdana, Arial\" size=\"1\"><b>\n";
print "<a href=\"../home.html\" title=\"Return to MN Car Sales home page\">· HOME PAGE ·</a><br>\n";
print "<a href=\"vehicles.cgi\" title=\"View our range of pre-owned vehicles\">· OUR VEHICLES ·</a><br>\n";
print "<a href=\"../vsearch.shtml\" title=\"Search for a specific vehicle\">· VEHICLE SEARCH ·</a><br>\n";
print "<a href=\"../partexchange.html\" title=\"Details of our part exchange services\">· PART EXCHANGE ·</a><br>\n";
print "<a href=\"../warranties.html\" title=\"Details of our comprehensive warranties\">· WARRANTIES ·</a><br>\n";
print "<a href=\"../finance.html\" title=\"Details of our financing services\">· FINANCE ·</a><br>\n";
print "<a href=\"../contact.html\" title=\"Contact or locate MN Car Sales\">· CONTACT US ·</a></b></font></p>\n";
print "</td>\n";
print "<td width=\"1%\" style=\"border-right: 3px double #000000\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "<td width=\"1%\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "<td width=\"97%\" valign=\"top\">\n";
print "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
print "<tr>\n";
print "<td background=\"../menubarback.jpg\"><b><i><font face=\"Verdana, Arial\" size=\"4\">Add New Vehicle</font></i></b></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td valign=\"top\">\n";
print "<p><font face=\"Verdana, Arial\" size=\"2\">Please use the form below to enter the details for the new vehicle which you wish to add to stock.</font></p>\n";
#print "<form method=\"POST\" name=\"add\" action=\"test.cgi\" enctype=\"multipart/form-data\" onSubmit=\"return checkForm()\">\n";
print "<form method=\"POST\" name=\"add\" action=\"test.cgi\" onSubmit=\"return checkForm()\">\n";
print "<input type=\"hidden\" name=\"scriptaction\" value=\"adddetails\"><input type=\"hidden\" name=\"reference\" value=\"$reference\">\n";
print "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Vehicle reference:</font></td>\n";
print "<td width=\"99%\"><font face=\"Verdana, Arial\" size=\"2\"><b>$reference</b></font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Make of vehicle:</font></td>\n";
print "<td width=\"99%\"><select size=\"1\" name=\"make\"><option selected>Please select from list</option>";
open (VMAKESFILE, "$vmakesfile"

;
@vmakesfile = <VMAKESFILE>;
close (VMAKESFILE);
foreach $dataline (@vmakesfile)
{
chomp $dataline;
($vmake) = split(/\|/, $dataline);
print "<option>$vmake</option>";
}
print "</select></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Model:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"model\" size=\"20\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Other:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"other\" size=\"20\"><font face=\"Verdana, Arial\" size=\"1\"><i> i.e., 2.0 DL, GTi, etc.</i></font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Year of manufacture:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"year\" size=\"5\" maxlength=\"4\"><font face=\"Verdana, Arial\" size=\"1\"><i> Please use four figure years</i></font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Engine size:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"engine\" size=\"5\"><font face=\"Verdana, Arial\" size=\"1\"><i> Enter numeric values only</i></font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Colour:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"colour\" size=\"20\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" valign=\"top\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Description:</font></td>\n";
print "<td width=\"99%\"><textarea name=\"details\" rows=\"8\" cols=\"50\"></textarea></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Price:</font></td>\n";
print "<td width=\"99%\"><input type=\"text\" name=\"price\" size=\"8\"><font face=\"Verdana, Arial\" size=\"1\"><i> Enter numeric values only with no pound sign</i></font></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Ownership:</font></td>\n";
print "<td width=\"99%\"><select size=\"1\" name=\"prefix\"><option>MNAA</option><option selected>MNCS</option></select><font face=\"Verdana, Arial\" size=\"1\"><i> Select 'MNCS' for MN Car Sales vehicles, 'MNAA' for all others</i></font></td>\n";
print "</tr>\n";
#print "<tr>\n";
#print "<td colspan=\"2\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
#print "</tr>\n";
#print "<tr>\n";
#print "<td colspan=\"2\"><font face=\"Verdana, Arial\" size=\"1\"><b>IMPORTANT:</b> Before you can add this new vehicle to stock you will need to have created the required images for displaying on the site.<br><br>File <b>mncs$reference.jpg</b> (main image) should be <b>300 x 240</b> pixels in size.<br>File <b>mnct$reference.jpg</b> (thumbnail) should be <b>100 x 80</b> pixels in size.<br><br>These images should be named <b>exactly</b> as specified here (i.e. all in lower case) and the file locations on your computer where they have been saved should be specified in the boxes below.</font></td>\n";
#print "</tr>\n";
#print "<tr>\n";
#print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Main image file location:</font></td>\n";
#print "<td width=\"99%\"><input type=\"file\" name=\"mainimage\" size=\"40\"></td>\n";
#print "</tr>\n";
#print "<tr>\n";
#print "<td width=\"1%\" align=\"right\" nowrap><font face=\"Verdana, Arial\" size=\"1\">Thumbnail image file location:</font></td>\n";
#print "<td width=\"99%\"><input type=\"file\" name=\"thumbimage\" size=\"40\"></td>\n";
#print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "<td width=\"99%\"><input type=\"submit\" value=\"Add details\" name=\"submit\" ID=\"submit\"></td>\n";
print "</tr>\n";
print "</table>\n";
print "</form>\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "</td>\n";
print "</tr>\n";
print "<tr><td colspan=\"4\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "</table>\n";
print "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\" background=\"../background.jpg\">\n";
print "<tr>\n";
print "<td align=\"right\" nowrap><p><font face=\"Verdana, Arial\" size=\"1\"><b>MN Car Sales, Proprietor: Mark Norton<br>St Andrews Yard, Willeys Avenue, Exeter, EX2 8EP<br>Enquiries: <a href=\"mailto:enquiries\@mncarsales.co.uk\" title=\"Send email to MN Car Sales\">enquiries\@mncarsales.co.uk</a><br>Tel: 01392 276728, mobile: 07974 382416 (24 hr)</b></font></p></td>\n";
print "</tr>\n";
print "</table>\n";
print "<p align=\"right\"><font face=\"Verdana, Arial\" size=\"1\" color=\"#808080\"><i>\n";
print "<script language=\"Javascript\" type=\"text/javascript\"><!--\n";
print "copyright()\n";
print "--></script>\n";
print "<br>Best viewed at 800 x 600 pixels with browser version 4.0 or later<br>Design, programming & maintenance by <a href=\"
title=\"Dotquake Web Services\" target=\"_blank\"><img src=\"../dwslogo.gif\" border=\"0\" align=\"absmiddle\" width=\"24\" height=\"14\"></a> <a href=\"
title=\"Dotquake Web Services\" target=\"_blank\">Dotquake Web Services</a></i></font></p>\n";
print "</body>\n";
print "</html>";
sub adddetails
{
# $form{details} =~ tr/\n/ /;
#
# open (STOCKFILE, ">$stockfile"

;
# flock (STOCKFILE, 2);
# seek (STOCKFILE, 0, 0);
#
# foreach $dataline (@stockfile)
# {
# chomp $dataline;
# ($reference, $make, $model, $other, $year, $engine, $colour, $details, $price, $prefix) = split(/\|/, $dataline);
#
# if ($reference eq $form{reference})
# {
# print STOCKFILE "$reference\|$form{make}\|$form{model}\|$form{other}\|$form{year}\|$form{engine}\|$form{colour}\|$form{details}\|$form{price}\|$form{prefix}\|\n";
# }
# else
# {
# print STOCKFILE "$dataline\n";
# }
# }
#
# flock (STOCKFILE, 8);
# close (STOCKFILE);
# open (THUMBIMAGE, ">../htdocs/images/mnct$form{reference}.jpg"

;
# binmode THUMBIMAGE;
#
# while (read("$form{thumbimage}", $buffer, 1024))
# {
# print THUMBIMAGE $buffer;
# }
#
# close THUMBIMAGE;
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
print "<meta name=\"Author\" content=\"Dotquake Web Services - info\@dotquake.com\">\n";
print "<meta name=\"Description\" content=\"MN Car Sales - Pre-owned cars from £300 upwards\">\n";
print "<meta name=\"Keywords\" content=\"car, sales, warranty, part exchange, bodywork repair, valet\">\n";
print "<link rel=\"stylesheet\" href=\"../style.css\" type=\"text/css\">\n";
print "<script language=\"Javascript\" src=\"../admin_add.js\" type=\"text/javascript\"></script>\n";
print "<title>MN Car Sales</title>\n";
print "</head>\n";
print "<body bgcolor=\"#F0F8FF\">\n";
print "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\" background=\"../background.jpg\">\n";
print "<tr>\n";
print "<td width=\"1%\" valign=\"top\" nowrap><img border=\"0\" src=\"../spacer.gif\" width=\"8\" height=\"8\"><img border=\"0\" src=\"../spacer.gif\" width=\"8\" height=\"8\"><img border=\"0\" src=\"../mncslogo.gif\" alt=\"MN Car Sales\" width=\"148\" height=\"77\"></td>\n";
print "<td width=\"99%\" align=\"right\" valign=\"top\"><p><b><font face=\"Verdana, Arial\" size=\"3\">· Pre-owned cars from £300 upwards<br>· Finance & warranties available<br>· Part exchanges welcomed<br>· All types of vehicle purchased for cash</font></b></p></td>\n";
print "</tr>\n";
print "</table>\n";
print "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
print "<tr>\n";
print "<td colspan=\"4\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td width=\"1%\" align=\"center\" valign=\"top\" nowrap background=\"../menubarback.jpg\">\n";
print "<p><font face=\"Verdana, Arial\" size=\"1\"><b>SITE MENU</b><br><br></font>\n";
print "<font face=\"Verdana, Arial\" size=\"1\"><b>\n";
print "<a href=\"../home.html\" title=\"Return to MN Car Sales home page\">· HOME PAGE ·</a><br>\n";
print "<a href=\"vehicles.cgi\" title=\"View our range of pre-owned vehicles\">· OUR VEHICLES ·</a><br>\n";
print "<a href=\"../vsearch.shtml\" title=\"Search for a specific vehicle\">· VEHICLE SEARCH ·</a><br>\n";
print "<a href=\"../partexchange.html\" title=\"Details of our part exchange services\">· PART EXCHANGE ·</a><br>\n";
print "<a href=\"../warranties.html\" title=\"Details of our comprehensive warranties\">· WARRANTIES ·</a><br>\n";
print "<a href=\"../finance.html\" title=\"Details of our financing services\">· FINANCE ·</a><br>\n";
print "<a href=\"../contact.html\" title=\"Contact or locate MN Car Sales\">· CONTACT US ·</a></b></font></p>\n";
print "</td>\n";
print "<td width=\"1%\" style=\"border-right: 3px double #000000\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "<td width=\"1%\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "<td width=\"97%\" valign=\"top\">\n";
print "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
print "<tr>\n";
print "<td background=\"../menubarback.jpg\"><b><i><font face=\"Verdana, Arial\" size=\"4\">Add New Vehicle</font></i></b></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td valign=\"top\">\n";
print "<p><font face=\"Verdana, Arial\" size=\"2\">The details for the new vehicle with reference number <b>$form{reference} ($form{make} $form{model})</b>, detailed below, have been successfully added and all relevant files have been uploaded and updated.</font></p>\n";
print "<p><font face=\"Verdana, Arial\" size=\"2\">Please click <a href=\"admin_add.cgi\" title=\"Add another new vehicle\">here</a> to add another new vehicle, <a href=\"admin_amend.cgi?method=POST&reference=$form{reference}\" title=\"Amend details for this vehicle\">here</a> to amend the details for this vehicle, or continue to navigate the site using the contents menu on the left of the screen.</font></p>\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "</td>\n";
print "</tr>\n";
print "<tr><td colspan=\"4\"><img src=\"../spacer.gif\" border=\"0\" width=\"8\" height=\"8\"></td>\n";
print "</tr>\n";
print "</table>\n";
print "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"100%\" background=\"../background.jpg\">\n";
print "<tr>\n";
print "<td align=\"right\" nowrap><p><font face=\"Verdana, Arial\" size=\"1\"><b>MN Car Sales, Proprietor: Mark Norton<br>St Andrews Yard, Willeys Avenue, Exeter, EX2 8EP<br>Enquiries: <a href=\"mailto:enquiries\@mncarsales.co.uk\" title=\"Send email to MN Car Sales\">enquiries\@mncarsales.co.uk</a><br>Tel: 01392 276728, mobile: 07974 382416 (24 hr)</b></font></p></td>\n";
print "</tr>\n";
print "</table>\n";
print "<p align=\"right\"><font face=\"Verdana, Arial\" size=\"1\" color=\"#808080\"><i>\n";
print "<script language=\"Javascript\" type=\"text/javascript\"><!--\n";
print "copyright()\n";
print "--></script>\n";
print "<br>Best viewed at 800 x 600 pixels with browser version 4.0 or later<br>Design, programming & maintenance by <a href=\"
title=\"Dotquake Web Services\" target=\"_blank\"><img src=\"../dwslogo.gif\" border=\"0\" align=\"absmiddle\" width=\"24\" height=\"14\"></a> <a href=\"
title=\"Dotquake Web Services\" target=\"_blank\">Dotquake Web Services</a></i></font></p>\n";
print "</body>\n";
print "</html>";
exit;
}
### New test.cgi script ###
#!/usr/bin/perl
print "Content-type: text/html\n\n";
if ($ENV{'REQUEST_METHOD'} eq "GET"

{
@argpairs = split(/&/, $ENV{'QUERY_STRING'});
}
else
{
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@argpairs = split(/&/, $buffer);
}
foreach $dataline (@argpairs)
{
($argname, $argvalue) = split(/=/, $dataline);
$argvalue =~ tr/+/ /;
$argvalue =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$argvalue =~ s/<!--(.|\n)*-->//g;
$argvalue =~ s/<([^>]|\n)*>//g;
$form{$argname} = $argvalue;
}
print "<html>\n";
print "<head>\n";
print "<title>Upload Test</title>\n";
print "</head>\n";
print "<body>\n";
print "reference = <b>$form{reference}</b><br>\n";
print "make = <b>$form{make}</b><br>\n";
print "model = <b>$form{model}</b><br>\n";
print "other = <b>$form{other}</b><br>\n";
print "year = <b>$form{year}</b><br>\n";
print "engine = <b>$form{engine}</b><br>\n";
print "colour = <b>$form{colour}</b><br>\n";
print "details = <b>$form{details}</b><br>\n";
print "price = <b>$form{price}</b><br>\n";
print "prefix = <b>$form{prefix}</b><br><br>\n";
print "scriptaction = <b>$form{scriptaction}</b><br>\n";
print "mainimage = <b>$form{mainimage}</b><br>\n";
print "thumbimage = <b>$form{thumbimage}</b><br>\n";
print "</body>\n";
print "</html>";
Thanks for all your help with this. I'm in your debt.
Phil.