I am a perl learner and believe me it is taking a rather lot out of me to learn this stuff.

So, I was wondering if somebody can help me please.

I've created a simple script that I'm using for genealogy. The only problem is, I can't administer my script.

Here is the coding below. I need an administration feature to remove a line if it is wrong etc.

Also, I'm trying to sort by alphebetically but I can't figure this out either.

Please can someone help me?

If I can do these two things it would be great.

#!/usr/bin/perl

# Exact Location of your script.
$me = "http://www.rootssearch.net/cgi-bin/testcgi/bap/postit.cgi";

# Path to your postit.html file
$ab_html = "/home/rootss/www/cgi-bin/testcgi/bap/postit.html";

# Configure your html header. You can use html between the EOF Tags
# You can also configure information on the name of the church, location,
# and when the records are dated from what to what.
$config{'header'} =<<"EOF";
<center><H1>Baptism Records</H1>
The rest of your html coding goes here. You can use this script for more than<BR>
one church by creating a directory for the church in your cgi-bin directory.</center>
<P>
EOF

# Configure your html footer. You can use html between the EOF Tags
$config{'footer'} =<<"EOF";
<P><CENTER>YOUR HTML FOOTER HERE</CENTER>
EOF

print "Content-type: text/html\n\n";
print "$config{'header'}";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<([^>]|\n)*>//g;
$value =~ s/<//g;
$value =~ s/>//g;
$FORM{$name} = $value;
}

if ($ENV{'QUERY_STRING'} =~ /Add/) { &Add; }
elsif ($ENV{'QUERY_STRING'} =~ /Display/) { &Display; }
elsif ($ENV{'QUERY_STRING'} =~ /Main/) { &Main; }
else { &Display; }

sub Main {
print qq~
<form action=$me?Add method=post>
<div align="center">
<center>
<table border="0" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="75%" height="317">
<tr>
<td width="100%" align="right" colspan="2" height="32">
<p align="left"><font face="Arial" size="2">To add a baptismal record to
the database, please enter the following information below.&nbsp;
Instructions are included with the form field information.&nbsp;
Remember that s/o means son of and d/o means daughter of. Or you can
<a href=$me>VIEW</a> the entries.</font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">Your Initials:</font></td>
<td width="78%" height="22"> <font face="Arial"> <input type=text name=name size=25><font size="2">
IE</font></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">Email
Address:</font></td>
<td width="78%" height="22"> <font face="Arial"> <input type=text name=email size=25></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">Surname:</font></td>
<td width="78%" height="22"> <font face="Arial"> <input type=text name=surname size=25></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">
Given Name: </font></td>
<td width="78%" height="22"><font face="Arial">
<input type=text name=given size=25></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">
Date of Birth:</font></td>
<td width="78%" height="22"><font face="Arial">
<input type=text name=dob size=25><font size="2"> As: 00/00/00</font></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">
Date of Baptism:</font></td>
<td width="78%" height="22"><font face="Arial">
<input type=text name=dobb size=25> <font size="2">As: 00/00/00</font></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">
Parents:</font></td>
<td width="78%" height="22">
<font face="Arial"> <input type=text name=parents size=25> <font size="2">As:
s/o or d/o Parents Names</font></font></td>
</tr>
<tr>
<td width="22%" align="right" height="22"><font face="Arial" size="2">
Sponsors:</font></td>
<td width="78%" height="22">
<font face="Arial"> <input type=text name=sponsors size=25> <font size="2">As:
John &amp; Jane Doe</font></font></td>
</tr>
<tr>
<td width="22%" align="right" height="17"></td>
<td width="78%" height="17">
<font face="Arial" size="2">Please review your information before you hit
submit!&nbsp; Thank you.</font></td>
</tr>
<tr>
<td width="22%" align="right" height="26">&nbsp;</td>
<td width="78%" height="26">
<font face="Arial">
<input type=submit value=Send></font></td>
</tr>
</table>
</center>
</div>
</form>
~;

print "$config{'footer'}";
}

sub Add {
if($FORM{'name'} eq "" ||
$FORM{'email'} eq "" ||
$FORM{'surname'} eq "" ||
$FORM{'given'} eq "" ||
$FORM{'dob'} eq "" ||
$FORM{'dobb'} eq "" ||
$FORM{'parents'} eq "" ||
$FORM{'sponsors'} eq "") {

print "<font face=Arial size=2>The following were left blank:";
print "<ul>\n";

if($FORM{'name'} eq "") {
print "<li>Your Initials\n";
}

if($FORM{'email'} eq "") {
print "<li>Your Email\n";
}

if($FORM{'surname'} eq "") {
print "<li>Surname\n";
}

if($FORM{'given'} eq "") {
print "<li>Given Name\n";
}

if($FORM{'dobb'} eq "") {
print "<li>Baptism Date\n";
}

print "</ul>\n";
print "Please use your browsers back button and fill out the rest of the forms.\n";
print "</font><P>\n";
}
else {
open FILE, ">>$ab_html" or print "[ERROR: Cannot open file]";
print FILE "<font face=Arial size=2><B>$FORM{'surname'}</B>, $FORM{'given'}, <B>B:</B> $FORM{'dob'}, <B>Bap:</B> $FORM{'dobb'}, <B>P:</B> $FORM{'parents'}, <B>Spon:</B> $FORM{'sponsors'}, <a href=\"mailto:$FORM{'email'}\">$FORM{'name'}</a></font><BR>\n";
print FILE "<!-- $ENV{'REMOTE_HOST'} -->\n\n";
close(FILE);

print "<P><font face=Arial size=2>Your entry has been added. <a href=\"$me\">Click here</a> to view the entries.";
print "<P><B><BIG>You submitted:</BIG></B></font><P>\n";
print "<font face=Arial size=2><B>$FORM{'surname'}</B>, $FORM{'given'}, <B>B:</B> $FORM{'dob'}, <B>Bap:</B> $FORM{'dobb'}, <B>P:</B> $FORM{'parents'}, <B>Spon:</B> $FORM{'sponsors'}, <a href=\"mailto:$FORM{'email'}\">$FORM{'name'}</a></font><BR>\n";
}
print "$config{'footer'}";
}

sub Display {
print "<P><font face=Arial size=2><a href=\"$me?Main\">Add A Record</a></font><P>\n";

open FILE, "$ab_html" or print "[ERROR: Cannot open file]";
while (<FILE>) {
print "$_";
}
close(FILE);

print "$config{'footer'}";
}