Skip to main content
daveharr1s0n
Inspiring
September 14, 2019
Question

Form no longer sending. It used to work great. Is it a CGI issue?

  • September 14, 2019
  • 3 replies
  • 839 views

Hello experts,

Recently my hosting had expired and all my files on GoDaddy were lost. No biggie, really. I think I found the original files on my computer, uploaded them, but now the form won't actually send when I hit the submit button.

 

Here is a link to the ugly but previously functional page: www.theotherdaveharrison.com/form.html

 

If you type something intothe text field and hit submit it gives an error message. (GoDaddy was unable to help). The email address that the form should send to is "dave@daveharrisonwebdesign.com" But part of the error message says "Please contact the server administrator at webmaster@theotherdaveharrison.daveharrison.info to inform them of the time this error occurred."

 

I don't know what "webmaster@theotherdaveharrison.daveharrison.info" is all about. They are two separate domains.

 

Any insight appreciated.

 

Thanks for any help,

 

Dave

 

--------

 

Here are the following CGI files that worked just fine before:

 

gdform:

 

#!/usr/bin/perl

sub parse_form_data
{
local (*FORM_DATA) = @_;
local ( $request_method, $query_string, @11361180_value_pairs, $key_value, $key, $value);
$request_method = $ENV{'REQUEST_METHOD'};
if ($request_method eq "GET") {
$query_string = $ENV{'QUERY_STRING'};
} elsif ($request_method eq "POST") {
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
};
@11361180_value_pairs = split(/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
if (defined($value)) {$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;};
if (defined($FORM_DATA{$key})) {
$FORM_DATA{$key} = join (" ", $FORM_DATA{$key}, $value);
} else {
$FORM_DATA{$key} = $value;
}
}
}; # end of sub

&parse_form_data(*simple_form);
$t = time;
chdir ($ENV{'DOCUMENT_ROOT'}) ; chdir("..");
open (OUTFILE, ">data/gdform_$t") or die ("Cannot open file");
while (($key , $value) = each(%simple_form)) {

print OUTFILE "<GDFORM_VARIABLE NAME=$key START>\n";
print OUTFILE "$value\n";
print OUTFILE "<GDFORM_VARIABLE NAME=$key END>\n";
if ($key eq "redirect") { $landing_page = $value;}

}
close (OUTFILE);
if ($landing_page ne "") {
print "Location: http://$ENV{'HTTP_HOST'}/$landing_page\n\n";
} else {
print "Location: http://$ENV{'HTTP_HOST'}/\n\n";
}

 

 

----

And gdformssl:

 

 

#!/usr/bin/perl

sub parse_form_data
{
local (*FORM_DATA) = @_;
local ( $request_method, $query_string, @11361180_value_pairs, $key_value, $key, $value);
$request_method = $ENV{'REQUEST_METHOD'};
if ($request_method eq "GET") {
$query_string = $ENV{'QUERY_STRING'};
} elsif ($request_method eq "POST") {
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
};
@11361180_value_pairs = split(/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
if (defined($value)) {$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;};
if (defined($FORM_DATA{$key})) {
$FORM_DATA{$key} = join (" ", $FORM_DATA{$key}, $value);
} else {
$FORM_DATA{$key} = $value;
}
}
}; # end of sub

&parse_form_data(*simple_form);
$t = time;
chdir ($ENV{'DOCUMENT_ROOT'}) ; chdir("..");
open (OUTFILE, ">data/gdform_$t") or die ("Cannot open file");
while (($key , $value) = each(%simple_form)) {

print OUTFILE "<GDFORM_VARIABLE NAME=$key START>\n";
print OUTFILE "$value\n";
print OUTFILE "<GDFORM_VARIABLE NAME=$key END>\n";
if ($key eq "redirect") { $landing_page = $value;}

}
close (OUTFILE);
if ($landing_page ne "") {
print "Location: https://$ENV{'HTTP_HOST'}/$landing_page\n\n";
} else {
print "Location: https://$ENV{'HTTP_HOST'}/\n\n";
}

    This topic has been closed for replies.

    3 replies

    Legend
    September 14, 2019
    Nancy OShea
    Community Expert
    Community Expert
    September 15, 2019
    Déjà vu!
    Nancy O'Shea— Product User & Community Expert
    Nancy OShea
    Community Expert
    Community Expert
    September 14, 2019

    The last time I used Perl  was last century.   It's not something I would use today however.    GoDaddy's Web & Classic hosting plan includes access to webformmailer.php script.   See details below.  

    https://www.godaddy.com/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376

     

     

     

     

    Nancy O'Shea— Product User & Community Expert
    daveharr1s0n
    Inspiring
    September 16, 2019

    Thanks, Nancy!

     

    I saw that, and tried following the instruction, but couldn't access my account to "manage" as I don't subscribe to their web builder tool thingie. It appears that it would be easy, reading the instruction, but not sure I want to pay the extra just to get a form to work. Can one do it outside of their webpage builder thingie and then upload the files? I haven't seen much on it in the little time I've considered it. Maybe php is the solution. Maybe I will have to pony up and subscribe.

     

    Appreciate your response and guidance as always!

     

    Thanks!

     

    Dave

    BenPleysier
    Community Expert
    Community Expert
    September 14, 2019

    The code that you have shown is only part of the action, namely it only parses the form data, data that is then transferred to an OUTFILE (located in the data subdirectory) The OUTFILE is where the sending of the email occurs. Once the OUTFILE has done its job, the user is redirected to the landing page, which in your case is thankyou.html.

     

    OUTFILE is a constant that is only applicable to your hosting environment; there is no input from outside. Which makes me wonder why GoDaddy was unable to help.

     

    There are other ways to send form data, but you need to have access to serverside code like PHP. For now I would suggest to get in touch with GoDaddy and ask to speak to a supervisor if the operator gives you a similar answer as before.

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    daveharr1s0n
    Inspiring
    September 16, 2019

    Thanks, Ben.

     

    I will email GoDaddy to see what they say. I don't SEE anything listed as OUTFILE in the directory or any of the folders when I connect, so maybe it's just not there? GoDaddy has a folder called cgi-bin, which is where I have uploaded those files to that previously worked.

     

    One thing I thought of, when I renewed my expired hosting with GoDaddy I chose a different domain as my primary, with what was primary as a subdomain. So I uploaded that ugly form page to the main public file and I come up with a different outcome. Almost seems like maybe I'm getting somewhere even though it still gets me nowhere. If you were to test the form out at www.daveharrison.info/form.html you will see it comes up with a "file not found - 404" error.

     

    Could there be something wrong with the cgi file(s)? Or do you think it might still point to some "OUTFILE" that might, or might not, be lurking somewhere in my directory?

     

    Thank you again. I always appreciate your help and replies!

     

    Dave

    BenPleysier
    Community Expert
    Community Expert
    September 16, 2019

    As I said, the OUTFILE is attached to your hosting environment and will be unique to each domain name. The instruction is

    open (OUTFILE, ">data/gdform_$t") or die ("Cannot open file");

     

    There is nothing that you can do about this. 

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!