Hi,
I’m now able to test very basic .cgi scripts (e.g. hello world) with ease.
My new problem is getting my .cgi scripts to interact with <html> Forms. So far I’ve been unsuccessful.
I used goboating’s basic .cgi FAQ (faq452-653).
(Just so you know, I’m testing my CGI scripts with Apache 1.3.19 on Windows 98. I also have Perl on my system).
1. Here’s the html Form I used…
[tt]
<HTML>
<HEAD><TITLE>Most Basic CGI Input Page</TITLE></HEAD>
<BODY>
<FORM ACTION=" c:/program files/apache/apache group/cgi-bin/emailtest.cgi " METHOD="POST">
<P>email, please:
<INPUT TYPE="TEXT" WIDTH="25" NAME="Email_Address">
</P></FORM></BODY></HTML>
[/tt]
I think part of the problem may lie in the following line…
[tt]
<FORM ACTION=" c:/program files/apache/apache group/cgi-bin/emailtest.cgi " METHOD="POST">
[/tt]
I have spaces in between the words program files and apache group. Could this be part of the reason that my scripts aren’t running?
2. Here’s the .cgi code I used…
[tt]
#!c:/perl/bin/bin/perl
use CGI;
$cgi = new CGI;
$this_prog = $cgi->self_url;
print $cgi->header,$cgi->start_html(-title=>"A Simple CGI Input Page"
my $email = $cgi->param('email');
if ($email)
{
# check to see if it looks like an email.
unless ($email =~ /.*@.*\.\w+/)
{ &killme("Not a valid email address" }
print "<P>Email is $email</P>\n";
print $q->end_html;
}
else
{ # no email submitted, we must need to send the input page.
print $cgi->center,
$cgi->h3($header),
$cgi->start_form(-method=>'POST', -action=>"$this_prog",
"Your email address: ",
$cgi->textfield(-name=>'email',
-size=>'25',
-maxlength=>'40'),
' ',$cgi->submit(-name=>'Submit', -value=>'submit'),
$cgi->endform,"</center>";
}
sub killme
{
print "<P>$_[0]</P>";
print $q->end_html;
die;
}
[/tt]
I’m lost. Isn’t this Form suppose to email me the email address entered in the Form?
Where do I specify my email address?
Thanks for reading,
Jenny
I’m now able to test very basic .cgi scripts (e.g. hello world) with ease.
My new problem is getting my .cgi scripts to interact with <html> Forms. So far I’ve been unsuccessful.
I used goboating’s basic .cgi FAQ (faq452-653).
(Just so you know, I’m testing my CGI scripts with Apache 1.3.19 on Windows 98. I also have Perl on my system).
1. Here’s the html Form I used…
[tt]
<HTML>
<HEAD><TITLE>Most Basic CGI Input Page</TITLE></HEAD>
<BODY>
<FORM ACTION=" c:/program files/apache/apache group/cgi-bin/emailtest.cgi " METHOD="POST">
<P>email, please:
<INPUT TYPE="TEXT" WIDTH="25" NAME="Email_Address">
</P></FORM></BODY></HTML>
[/tt]
I think part of the problem may lie in the following line…
[tt]
<FORM ACTION=" c:/program files/apache/apache group/cgi-bin/emailtest.cgi " METHOD="POST">
[/tt]
I have spaces in between the words program files and apache group. Could this be part of the reason that my scripts aren’t running?
2. Here’s the .cgi code I used…
[tt]
#!c:/perl/bin/bin/perl
use CGI;
$cgi = new CGI;
$this_prog = $cgi->self_url;
print $cgi->header,$cgi->start_html(-title=>"A Simple CGI Input Page"
my $email = $cgi->param('email');
if ($email)
{
# check to see if it looks like an email.
unless ($email =~ /.*@.*\.\w+/)
{ &killme("Not a valid email address" }
print "<P>Email is $email</P>\n";
print $q->end_html;
}
else
{ # no email submitted, we must need to send the input page.
print $cgi->center,
$cgi->h3($header),
$cgi->start_form(-method=>'POST', -action=>"$this_prog",
"Your email address: ",
$cgi->textfield(-name=>'email',
-size=>'25',
-maxlength=>'40'),
' ',$cgi->submit(-name=>'Submit', -value=>'submit'),
$cgi->endform,"</center>";
}
sub killme
{
print "<P>$_[0]</P>";
print $q->end_html;
die;
}
[/tt]
I’m lost. Isn’t this Form suppose to email me the email address entered in the Form?
Where do I specify my email address?
Thanks for reading,
Jenny