I'm trying to make a form using cgi.pm the output of which will be
saved to a .html file. But the variables are not parsing correctly. If
I put 3 names in 3 different places they all appear together instead
of each appearing on each individual section. Here's my code:


#!/usr/bin/perl

use CGI qw(:standard);

print header;
print start_html('Rent Form'),
   h1('Lab Form'),
   h2('Washington'),
   start_form,
   "Person's Name? ",textfield('name'),
   p,
   "What's your favorite mail client?",
   p,
   checkbox_group(-name=>'words',
                  -values=>['mutt','mail','pico','sylpheed'],
                  -defaults=>['mutt','mail']),
   p,
   "Editor ",
   popup_menu(-name=>'heh',
              -values=>['emacs','vi','ed','cat']),
   p,
h2('Maryland'),
start_form,
"Person Name? ",textfield('name'),
p,
"What's your favorite mail client?",
p,
checkbox_group(-name=>'words',
                  -values=>['mutt','mail','pico','sylpheed'],
                  -defaults=>['mutt','mail']),
p,

h2('New York Division'),
start_form,
"Person Name? ",textfield('name'),
p,
"What's your favorite mail client?",
p,
checkbox_group(-name=>'words',
                  -values=>['mutt','mail','pico','sylpheed'],
                  -defaults=>['mutt','mail']),
p,
submit,
   end_form,
   hr;

open(FH, ">/tmp/result.html")              or die "can't append to
html file: $!";
print FH start_html('Rent Form');
print FH h1('Lab Form');
print FH h2('Washington');
print FH "tenant name is", em(param('name'));
print FH h2('Maryland');
print FH "tenant name is", em(param('name'));
print FH h2('New York');
print FH "tenant name is", em(param('name'));
flock(FH, 2)                            or die "can't flock formlog: $!";

# either using the procedural interface
# use CGI qw(:standard);
save_parameters(*FH);                   # with CGI::save

# or using the object interface
use CGI;
$query = CGI->new();
$query->save(*FH);
close(FH)                               or die "can't close formlog: $!";
print end_html;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to