Gossamer Forum
Home : General : Perl Programming :

HELP!! CGI form input not being written to file

Quote Reply
HELP!! CGI form input not being written to file
I am a newbie so please be patient with me. I have created a CGI form. The form works OK but the input from the user is not being written to the file I have specified. My emailer is not working either.
Can someone help? I have tried everything!
Here is the code:
#!C:/Perl/bin/perl.exe -w
use CGI;
use CGI::Carp qw( fatalsToBrowser );
require "cgi-lib.pl";
# Create the CGI object
my $query = new CGI;
# Output the HTTP header
print $query->header ( );
# Process form if submitted; otherwise display it
if ( $query->param("submit") )
{
process_form ( );
}
else
{
display_form ( );
}
sub process_form
{
if ( validate_form ( ) )
{
print <<END_HTML;
<html><head><title>Thank You</title></head>
<body>
Thank you for your metadata entry.<br>
The new metadata information has been sent to Metadata Systems Engineering for review.<br>
<A HREF="http://isd.kodak.com/imgscience/best_practices/metadata/md_regstry/index.html">Return to Registry</A>
</body></html>
END_HTML
}
}
sub validate_form
{
my $insuranceno = $query->param("insuranceno");
my $firstname = $query->param("firstname");
my $lastname = $query->param("lastname");
my $email = $query->param("email");
my $phoneno = $query->param("phoneno");
my $building = $query->param("building");
my $floor = $query->param("floor");
my $plant = $query->param("plant");
my $project = $query->param("project");
my $category = $query->param("category");
my $metadataname = $query->param("metadataname");
my $metadatadefinition = $query->param("metadatadefinition");
my $error_message = "";

$error_message .= "insurance number, " if ( !$insuranceno );
$error_message .= "first name, " if ( !$firstname );
$error_message .= "last name, " if ( !$lastname );
$error_message .= "email address, " if ( !$email );
$error_message .= "phone number, " if ( !$phoneno );
$error_message .= "project, " if ( !$project );
$error_message .= "category, " if ( $category eq "Select One" );
$error_message .= "metadata name, " if ( !$metadataname );
$error_message .= "metadata definition." if ( !$metadatadefinition );

if ( $error_message )
{
display_form ( $error_message, $insuranceno, $firstname, $lastname, $email, $phoneno, $building, $floor, $plant, $project,
$category, $metadataname, $metadatadefinition );
return 0;
}
else
{
return 1;
}
}
sub display_form
{
my $error_message = shift;
my $insuranceno = shift;
my $firstname = shift;
my $lastname = shift;
my $email = shift;
my $phoneno = shift;
my $building = shift;
my $floor = shift;
my $plant = shift;
my $project = shift;
my $category = shift;
my $metadataname = shift;
my $metadatadefinition = shift;
my $category_html = "";
my @category_opts = ( "Select One", "CaptureConditions", "CaptureDevice", "DigitalProcess", "ImageContainer", "IntellectualProperty",
"OutputOrder", "SceneContent");
foreach my $category_option ( @category_opts )
{
$category_html .= "<option value=\"$category_option\"";
$category_html .= " selected" if ( $category_option eq $category );
$category_html .= ">$category_option</option>";
}

# Display the form
print <<END_HTML;
<html>
<head><title>Submission of New Metadata</title></head>
<body><font size = "4" face = "Times New Roman">
<table><tr><p><td align="RIGHT" WIDTH="520"><font size = "3" color="#AD0000">Welcome to Metadata Engineering's New Metadata Submission web
site. Please fill in the information below. When you are done, click on the Submit button. The information you have entered will be recorded
in a database. Email verification will also be sent to Metadata Engineering as well as to you. You will be contacted at a later date if there
are any questions concerning your entry.</font></td></p></tr>
<td align="RIGHT"><font size = "4" face = "Times New Roman"><b> Enter the following contact information: </b></font></td></tr>
<form action="form_validation.cgi" method="post">
<input type="hidden" name="submit" value="Submit">
<p><td align="RIGHT" WIDTH="520"><font color="red"><i><b>$error_message<br></td></font></i></b></p>

<tr><td align="RIGHT"><i>Items with a check <IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16"
BORDER="0" ALIGN="ABSMIDDLE"> are required.</i></td></tr>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Insurance Number <input type="text" name="insuranceno" value="$insuranceno" SIZE="6" MAXLENGTH="6"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">First Name <input type="text" name="firstname" value="$firstname" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Last Name <input type="text" name="lastname" value="$lastname" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Email Address <input type="text" name="email" value="$email" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Phone No.<input type="text" name="phoneno" value="$phoneno"></td></tr>
<tr><td align="RIGHT">Building <input type="text" name="building" value="$building"></td></tr>
<tr><td align="RIGHT">Floor <input type="text" name="floor" value="$floor"></td></tr>
<tr><td align="RIGHT">Plant <input type="text" name="plant" value="$plant"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Project <input type="text" name="project" value="$project" SIZE="35" MAXLENGTH="100"></td></tr>\n
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><font size = "4"><b> Metadata Information to be submitted: </b></font></td></tr>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="ABSMIDDLE
">Category <select name="category">$category_html</select></td></tr><br>
<tr><td align="right" CLASS="body1"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0"
ALIGN="ABSMIDDLE">Metadata Name <input type ="text" name="metadataname" value="$metadataname" SIZE="50" MAXLENGTH="100"><br></td></tr>
<tr><td align="RIGHT" valign="TOP"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" text
ALIGN="bottom">Metadata Definition <textarea name="metadatadefinition" value="$metadatadefinition" rows="6" cols="45" WRAP></textarea></td><
/tr><br>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><input type="submit" name="submit" value="Submit"></td></tr>
</form></font></table></body></html>
END_HTML
}
#Append new metadata entry to text file database
$registry = "NewMetadataDB.txt";
sub readparse_form
{
# Add to registry
# Generate mail messages
#&AppendRegistry(*input, $registry);
if (&ReadParse( ) )
{
my $insuranceno = $query->param('insuranceno');
my $firstname = $query->param('firstname');
my $lastname = $query->param('lastname');
my $email = $query->param('emailaddress');
my $phoneno = $query->param('phoneno');
my $building = $query->param('building');
my $floor = $query->param('floor');
my $plant = $query->param('plant');
my $project = $query->param('project');
my $metadataname = $query->param('metadataname');
my $metadatadefinition = $query->param('metadatadefinition');
}
else
{
die "Unable to extract needed variables";
}
}
#Open file and write input to registry file
open (REG, ">>$registry") || die "Can't open file.";
print REG "$insuranceno $firstname $lastname $email $phoneno $building $floor $plant $project $metadataname $metadatatype \n";
print REG "$metadatadefinition\n";
close (REG);

#----------------------EMAIL NOTIFICATION TO KMM AND USER---------------------------------
# Define Variables for emailing form info
$mailprog = 'sendmail.exe';
$recipient1 = 'Katherine.miller-mullins@kodak.com';
$subject = "Submission of New Metadata Object to Metadata Engineering Systems";

# Open The Mail
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog\n";
print MAIL "To: $recipient1 $recipient2\n";
print MAIL "From: $emailaddress\n";
print MAIL "Subject: $subject\n";
print MAIL "The following information was submitted:\n\n";
print MAIL "Insurance Number: $insuranceno\n";
print MAIL "Name: $firstname $lastname'}\n";
print MAIL "Email: $emailaddress\n";
print MAIL "Phone Number: $phoneno\n";
print MAIL "Building: $building\n";
print MAIL "Floor: $floor\n";
print MAIL "Plant: $plant\n";
print MAIL "Project: $project\n";
print MAIL "Metadata Name: $metadataname\n";
print MAIL "Metadata Definition: $metadatadefinition\n\n";
print MAIL "The information you have submitted is under review.\n\n\n";
close (MAIL);

#----------------------CGI-LIB.PL---------------------------------
###CGI-LIB.PL
### Adapted from cgi-lib.pl by S.E.Brenner@bioc.cam.ac.uk
### Copyright 1994 Steven E. Brenner
sub ReadParse {
local (*in) = @_ if @_;
local ($i, $key, $val);

### replaced his MethGet function
if ( $ENV{'REQUEST_METHOD'} eq "GET" ) {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
} else {
# Added for command line debugging
# Supply name/value form data as a command line argument
# Format: name1=value1\&name2=value2\&...
# (need to escape & for shell)
# Find the first argument that's not a switch (-)
$in = ( grep( !/^-/, @ARGV )) [0];
$in =~ s/\\&/&/g;
}

@in = split(/&/,$in);

foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;

# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.

# Convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;

# Associate key and value. \0 is the multiple separator
$in{$key} .= "\0" if (defined($in{$key}));
$in{$key} .= $val;
}
return length($in);
}

And here are the errors I'm getting:
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Name "main::metadatatype" used only once: possible typo at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Subroutine ReadParse redefined at cgi-lib.pl line 54., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 180., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 181., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 196., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 200., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 201., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 201., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 202., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 203., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 204., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 205., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 206., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 207., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 208., referer: http://150.220.3.194:8081/.../form_validation.cgi
[Tue Jun 22 11:11:38 2004] [error] [client 150.220.3.194] [Tue Jun 22 11:11:38 2004] form_validation.cgi: Use of uninitialized value in concatenation (.) or string at C:/Program Files/Apache Group/Apache2/cgi-bin/form_validation.cgi line 209., referer: http://150.220.3.194:8081/.../form_validation.cgi
Heeeeeeeeelp!!!!!!!
Quote Reply
Re: [esgwyd2] HELP!! CGI form input not being written to file In reply to
Hi... just a tip :)

You use CGI.pm .. but then you are grabbing the form values from QUERY_STRING?

Why not just use something like;

Code:
use CGI;
my $IN = new CGI;

print $IN->header();
print $IN->param('parameter_name');

... then you can get rid of all the LIB stuff at the bottom of your script (CGI.pm handles all this kind of stuff a lot better ... I used to use the same way to parse forms... but then someone introduced me to CGI.pm Smile).

Hope that helps.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] HELP!! CGI form input not being written to file In reply to
Hi, Andy!
Sorry for bothering you again.
Thanks so much for your quick response. I greatly appreciate all the help I can get on this.

I followed your instructions but I'm still getting the same error msgs (Use of uninitialized value in concatenation (.) or string).
Also, the user's input is still not writing out to the file. I have again tried several things but nothing fixed the problem. Frown
Here's the updated code:

#!C:/Perl/bin/perl.exe -w

use CGI::Carp qw( fatalsToBrowser );
use CGI;

my $IN = new CGI;

CGI::ReadParse(*in);

print $IN->header();
print $IN->param('parameter_name');

# Process form if submitted; otherwise display it
if ( $IN->param("submit") )
{
process_form ( );
}
else
{
display_form ( );
}
sub process_form
{
if ( validate_form ( ) )
{
print <<END_HTML;
<html><head><title>Thank You</title></head>
<body>
Thank you for your metadata entry.<br>
The new metadata information has been sent to Metadata Systems Engineering for review.<br>
<A HREF="http://isd.kodak.com/imgscience/best_practices/metadata/md_regstry/index.html">Return to Registry</A>
</body></html>
END_HTML
}
}
sub validate_form
{
my $insuranceno = $IN->param("insuranceno");
my $firstname = $IN->param("firstname");
my $lastname = $IN->param("lastname");
my $email = $IN->param("email");
my $phoneno = $IN->param("phoneno");
my $building = $IN->param("building");
my $floor = $IN->param("floor");
my $plant = $IN->param("plant");
my $project = $IN->param("project");
my $category = $IN->param("category");
my $metadataname = $IN->param("metadataname");
my $metadatadefinition = $IN->param("metadatadefinition");
my $error_message = "";

$error_message .= "insurance number, " if ( !$insuranceno );
$error_message .= "first name, " if ( !$firstname );
$error_message .= "last name, " if ( !$lastname );
$error_message .= "email address, " if ( !$email );
$error_message .= "phone number, " if ( !$phoneno );
$error_message .= "project, " if ( !$project );
$error_message .= "category, " if ( $category eq "Select One" );
$error_message .= "metadata name, " if ( !$metadataname );
$error_message .= "metadata definition." if ( !$metadatadefinition );

if ( $error_message )
{
display_form ( $error_message, $insuranceno, $firstname, $lastname, $email, $phoneno, $building, $floor, $plant, $project,
$category, $metadataname, $metadatadefinition );
return 0;
}
else
{
return 1;
}
}
sub display_form
{
my $error_message = shift;
my $insuranceno = shift;
my $firstname = shift;
my $lastname = shift;
my $email = shift;
my $phoneno = shift;
my $building = shift;
my $floor = shift;
my $plant = shift;
my $project = shift;
my $category = shift;
my $metadataname = shift;
my $metadatadefinition = shift;
my $category_html = "";
my @category_opts = ( "Select One", "CaptureConditions", "CaptureDevice", "DigitalProcess", "ImageContainer", "IntellectualProperty
", "OutputOrder", "SceneContent");
foreach my $category_option ( @category_opts )
{
$category_html .= "<option value=\"$category_option\"";
$category_html .= " selected" if ( $category_option eq $category );
$category_html .= ">$category_option</option>";
}

# Display the form
print <<END_HTML;
<html>
<head><title>Submission of New Metadata</title></head>
<body><font size = "4" face = "Times New Roman">
<table><tr><p><td align="RIGHT" WIDTH="520"><font size = "3" color="#AD0000">Welcome to Metadata Engineering's New Metadata Submission web
site. Please fill in the information below. When you are done, click on the Submit button. The information you have entered will be recorded
in a database. Email verification will also be sent to Metadata Engineering as well as to you. You will be contacted at a later date if
there are any questions concerning your entry.</font></td></p></tr>
<td align="RIGHT"><font size = "4" face = "Times New Roman"><b> Enter the following contact information: </b></font></td></tr>
<form action="form_validation.cgi" method="post">
<input type="hidden" name="submit" value="Submit">
<p><td align="RIGHT" WIDTH="520"><font color="red"><i><b>$error_message<br></td></font></i></b></p>

<tr><td align="RIGHT"><i>Items with a check <IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16"
BORDER="0" ALIGN="ABSMIDDLE"> are required.</i></td></tr>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Insurance Number <input type="text" name="insuranceno" value="$insuranceno" SIZE="6" MAXLENGTH="6"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">First Name <input type="text" name="firstname" value="$firstname" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Last Name <input type="text" name="lastname" value="$lastname" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Email Address <input type="text" name="email" value="$email" SIZE="35" MAXLENGTH="100"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Phone No.<input type="text" name="phoneno" value="$phoneno"></td></tr>
<tr><td align="RIGHT">Building <input type="text" name="building" value="$building"></td></tr>
<tr><td align="RIGHT">Floor <input type="text" name="floor" value="$floor"></td></tr>
<tr><td align="RIGHT">Plant <input type="text" name="plant" value="$plant"></td></tr>
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Project <input type="text" name="project" value="$project" SIZE="35" MAXLENGTH="100"></td></tr>\n
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><font size = "4"><b> Metadata Information to be submitted: </b></font></td></tr>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0" ALIGN="
ABSMIDDLE">Category <select name="category">$category_html</select></td></tr><br>
<tr><td align="right" CLASS="body1"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0"
ALIGN="ABSMIDDLE">Metadata Name <input type ="text" name="metadataname" value="$metadataname" SIZE="50" MAXLENGTH="100"><br></td></tr>
<tr><td align="RIGHT" valign="TOP"><IMG SRC="http://150.220.3.194:8081/icons/check.gif" HEIGHT="16" WIDTH="16" BORDER="0"
text ALIGN="bottom">Metadata Definition <textarea name="metadatadefinition" value="$metadatadefinition" rows="6" cols="45" WRAP></
textarea></td></tr><br>
<tr><td align="RIGHT">&nbsp</td></tr>\n
<tr><td align="RIGHT"><input type="submit" name="submit" value="Submit"></td></tr>
</form></font></table></body></html>
END_HTML
}
#Append new metadata entry to text file database
$registry = "NewMetadataDB.txt";
sub readparse_form
{
# Add to registry
# Generate mail messages
#&AppendRegistry(*input, $registry);
if (&ReadParse(*IN) )
{
$insuranceno = $IN->param('insuranceno');
$firstname = $IN->param('firstname');
$lastname = $IN->param('lastname');
$email = $IN->param('emailaddress');
$phoneno = $IN->param('phoneno');
$building = $IN->param('building');
$floor = $IN->param('floor');
$plant = $IN->param('plant');
$project = $IN->param('project');
$metadataname = $IN->param('metadataname');
$metadatadefinition = $IN->param('metadatadefinition');
}
else
{
die "Unable to extract needed variables";
}
}

#Open file and write input to registry file
open (REG, ">>$registry") || die "Can't open file.";
print REG "$insuranceno $firstname $lastname $email $phoneno $building $floor $plant $project $metadataname $metadatatype \n";
print REG "$metadatadefinition\n";
close (REG) || die "Can't close file.";

#----------------------EMAIL NOTIFICATION TO KMM AND USER---------------------------------
# Define Variables for emailing form info
$mailprog = 'sendmail.exe';
$recipient1 = 'blablabla@bla.com';
$subject = "Submission of New Metadata Object to Metadata Engineering Systems";

# Open The Mail
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog\n";
print MAIL "To: $recipient1 \n";
print MAIL "From: $emailaddress\n";
print MAIL "Subject: $subject\n";
print MAIL "The following information was submitted:\n\n";
print MAIL "Insurance Number: $insuranceno\n";
print MAIL "Name: $firstname $lastname'}\n";
print MAIL "Email: $emailaddress\n";
print MAIL "Phone Number: $phoneno\n";
print MAIL "Building: $building\n";
print MAIL "Floor: $floor\n";
print MAIL "Plant: $plant\n";
print MAIL "Project: $project\n";
print MAIL "Metadata Name: $metadataname\n";
print MAIL "Metadata Definition: $metadatadefinition\n\n";
print MAIL "The information you have submitted is under review.\n\n\n";
close (MAIL);
Quote Reply
Re: [esgwyd2] HELP!! CGI form input not being written to file In reply to
You can try to use the words in and IN but you will get errors.

See line 8 of your code for " CGI::ReadParse(*in); " and later
near line 150 ish " if (&ReadParse(*IN) ) "

They do not equate, Mr Spock would not be happy !

Try
use strict;

to avoid spelling or names of wrong case errors.

There are some other errors , but you have to find the simple ones first.

good luck

cornball