[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] More help



>Hello All:
>
>I have done what I could. I deleted and corrected as guided. It is 
>still showing
>error.  I will be thankful for your help which I am unable to find. Thanks
>I hope I have been able to present my difficulties correctly.
>
>Thanks
>
>Amitava


Hi Amitava,

1. (Error 1) Replace the hash identifier 'registration-data'  with 
'registration_data'  (Perl thinks
     you are doing a substraction)

2. Either use $registration_data{"FirstName"} $registration-data{"LastName"} or
     $registration_data{"First Name"} $registration-data{"Last Name"} , but not
     both if you mean the same thing (note the additional space)

3. (Error 2) You've used the statement print<<"EOP";  two times, but 
I see only one here-doc terminator.
     I've replaced the first 'EOP' with 'HEAD' in the corrected 
script, see below.

4. Replace $Registration_Type = "Submit Registration"} with
     $Registration_Type = "Submit Registration";  on #line 33

5. HTML error(missing <) on #line 46

6. Add a curly bracket on  #line 85 (if-statement)

7. Generally, use a more readable coding style: use tabs, spaces, 
indents etc. and sometimes
     a comment :). This  will help you to detect errors more easily.


And here is the corrected script, which should compile without syntax errors:
___________

#!/usr/local/bin/perl -w
push (@INC,"/usr/localbusiness/http/accn.com/cgi-bin");
require("cgi-lib.pl");
print &PrintHeader;

&ReadParse(*registration_data);
print << "HEAD";
<html>
<head>
<title>Aztec Registration Form</title>
</head>
<body>
HEAD

if (length($registration_data{"FirstName"}) > 0  && 
length($registration_data{"LastName"}) > 0) {
     print<<"EOP";
<h3>
Thank you $registration_data{"FirstName"} $registration_data{"LastName"}
for registering your name with Aztec. You will now verify the
information entered in the form. Please Correct if necessary</h3>
EOP

     $Registration_Type = "Confirm Registration Data";
     print "<ul>";
     foreach $var ( keys (%registration_data) ) {
         if ( length($registration_data{"$var"} ) == 0) {
              print "<li>Your<em>$var</em>will be used to help confirm 
your order
              Please fill in the <em>$var</em>field";
         }#if
     }#for
     print "</ul>";
} else {
     $Registration_Type = "Submit Registration";           # line 33
     if (defined($registration_data{"Phone Number"})) {
          $PhoneNumber=$registration_data{"Phone Number"};
     } else {
         $PhoneNumber="(999) 999-999";
     }#if

     print <<'TEST';
<hr noshade>
<center>
<Form Method=POST Action="/cgibook/regs.cgi">
<input type=hidden name=SavedName 
value="registration_data{'FirstName'}$registration_data {'LastName'}">
<table border=0 width=60%>
<caption align = top><h3>Aztec Registration Form</h3></caption>    #line 46
<th ALIGN LEFT>First Name
<th ALIGN LEFT colspan=2>LastName<tr>
<td>
<input type=text size=32 maxlength=20
name="First Name" value=Registration data{"FirstName"}>
<td colspan=2>
<input type=text size=32 maxlength=40
name="Last Name" value=$registration_data{"LastName"} ><tr>
<th ALIGN=LEFT colspan=3>
  Street Address <td><td><tr>
<td colspan=3>
<input type=text size=61 maxsize=61
name"Street" value:$registration_data {'Street'}"><tr>
<th ALIGN LEFT>City
<th ALIGN LEFT>State
<th ALIGH LEFT>Zip <tr>
<td><input type =text sixe=20 maxlength=30
name=="City" value="$registration_data{'City'}">
<td><input type =text sixe=20 maxlength=20
name=="State" value="$registration_data{'State'}">
<td><input type =text size=5 maxlength=10
name=="Zip" value="$registration_data{'Zip'}"><tr>
<th ALIGN=LEFT  colspan=1>Phone Number
<th ALIGN=LEFT  colspan=2>E-Mail Address<tr>
<td colspan=1><input type=test size=15 maxlength=15
name="Phone Number" value="$PhoneNumber">
<td colspan=2><input type=test size=32 maxlength=32
name="E-Mail Address" value={"$EmailAddress"} ><tr>
<td width=50%><input type="submit" name="simple" value=$Registration-Type>
<td width=50%><input type="reset"><tr>
</table>
</FORM>
</center>
<hr noshade>
</body>
</html>
TEST

}#if             #line 85


__END__

HTH.

Best regards,

--Thomas

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org