New user: form submit gives an option to download the file

33 views
Skip to first unread message

dd137

unread,
Oct 3, 2011, 5:26:01 PM10/3/11
to perl-formbuilder
hello,

I just started using FormBuilder and am having trouble figuring out
what happens on submit. Im trying to capture input from the form and
use the same input as arguments to another perl script that does a
bunch of stuff.

When I hit "Submit" on my form, I only get an option to download the
perl file itself (if its in the same dir as the html), else, there's a
file not found error on the same perl file.

Here's what I do -
if ($form->submitted eq 'Submit') {
# you would write code here to act on the form data
$cname = $form->field('Compiler');
$bit = $form->field('Bit');
#Do some stuff with $cname and $bit to call another script

print $form->confirm(header => 1);
} else {
print $form->render(header => 1);
}

What am I doing wrong?

Wolfgang Radke

unread,
Oct 4, 2011, 1:24:31 AM10/4/11
to perl-for...@googlegroups.com
Hello 'dd137',

are you working with unix/linux?
if so:
- check whether your perl file is executable
- check whether your http-daemon (apache?) considers the file/dir
executable

Better yet: Put the perl-file into cgi-bin

Wolfgang

dd137

unread,
Oct 4, 2011, 4:00:41 PM10/4/11
to perl-formbuilder
Hello,

I try executing the simple form pl file but get an internal server
error.

When I run a simple perl test file, it runs fine..
Here's what I test with

#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "hello World\n";

When I run the simple form pl file, I see the error
#!/usr/bin/perl

use CGI::FormBuilder;

@fields = qw(first_name last_name email phone);

$form = CGI::FormBuilder->new(
fields => \@fields,
);

if($form->submitted && $form->validate) {
$fname = $form->field('first_name');
$lname = $form->field('last_name');

print $form->confirm(header => 1);
} else {
print $form->render(header => 1);
}


The script runs ok on the terminal and spits out html code. On the
browser, its always internal server error.

Please help.


On Oct 4, 12:24 am, "Wolfgang Radke" <wora1...@googlemail.com> wrote:
> Hello 'dd137',
>
> are you working with unix/linux?
> if so:
> - check whether your perl file is executable
> - check whether your http-daemon (apache?) considers the file/dir  
> executable
>
> Better yet: Put the perl-file into cgi-bin
>
> Wolfgang
>

Wolfgang Radke

unread,
Oct 4, 2011, 4:23:38 PM10/4/11
to perl-for...@googlegroups.com
Hi dd137,
looks like the file is not being considered executable by the server
did you put your script in the directory cgi-bin? If not, please do so.

which operating system are you using?

Wolfgang

Reply all
Reply to author
Forward
0 new messages