Phillip Bruce wrote:
Hi,

  I have the following form that I use as survey I that I'm
  building for my web site.

<snip form>



Now here is the CGI script I've written so far.


#!/usr/bin/perl # use Mail::Internet;


use strict; # always use warnings; # usually, at least during development

# Collect parameters using CGI
my $customer = param("Customer");
my $learn = param("Learn");
my $opinion = param("Site Opinion");
my $improvements = param("Site Iimprovement");
my $comments = param("comments");


In the above section you are using a function of the CGI module 'param' but you have not loaded the CGI module, you need another use statement:


use CGI;

You may also want to get all the params at once into a hash, but I leave that to you, have a look at the docs for the CGI module:

perldoc CGI

my $head = Mail::Header->new;

What does this do on failure? you haven't checked return codes...


$head->add(From => 'Webmaster <[EMAIL PROTECTED]>');
$head->add(To   => '[EMAIL PROTECTED]');
$head->add(Subject => 'hello there');

my $body = <<END;
This is just a simple e-mail message.
Nothing to get excited about.

Customer Type: $customer
How they learn of us: $learn
Their Opinions: $opinion
Their improvemetns: $improvements
Their comments: $comments
END

$mail = Mail::Internet->new(Header => $head,
                            Body   => [$body],
                            Modify => 1);
print $mail->send('sendmail');


You have not printed a header back to the browser, usually something like: Content-type:text/html\n\n, though again see the docs for the CGI module for easy ways to do this.


end of cgi script.

What I'm concern with is the execution of this script.
I don't seem to be doing something right. Can someone
correct on what it that missing.



Usually the best way to find out problems with a CGI script is to check the server's error log, or use a 'fatalstobrowser' type of deal, see the CGI docs for this also...


http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to