Copy link to clipboard
Copied
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, @Key_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'});
};
@Key_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, @Key_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'});
};
@Key_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";
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thanks, Ben,
Yes, Godaddy was no help. Very weird as prior to my hosting expiring it all worked just dandy. Funny they have a cgi-bin folder, but seem to have no info on CGI. And my old laptop is too slow that it won't load the GoDaddy control panel. So I went to the library and used a public computer. I was almost able to figure out their php form mailer thingie in the limited time (I think). Their step by step instructions leave much to be desired. Anyway, I might have to go back and look again.
GoDaddy DID however put a form mail test up for me. It does work, but the form is not at all what I want. All I want is a comment box with the option to SEND, to CLEAR (erase comments and start over), and be redirected to my Thank You page. I don't want a web visitor having to enter my email address to send me a comment.
Is there any way for me to just modify this somehow to make it my "contact me" form? I really don't want to have to frog around in Godaddy's control panel if I don't have to. here is the link if it means anything ... http://daveharrison.info/mail_test.php
Thanks again,
Dave
Oh, quick question. If I try to start over with CGI, how do I convert (?) a .txt file to .pl or .cgi and upload from Dreamweaver?
Copy link to clipboard
Copied
Dave, have a look at a tutorial that Nancy wrote: https://alt-web.blogspot.com/2015/07/responsive-contact-form-with-bootstrap.html
Copy link to clipboard
Copied
Thanks Ben.
I just worked my way through the tutorial. The form seems to work although nothing coming through in my email. I'll ask Nancy. I'm sure it has to be something simple.
Always appreciate your help!
Dave
Copy link to clipboard
Copied
Ah, finally. I found a very short, very simple YouTube video on what the problem at GoDaddy was. Apparently their hosting is set up with an MX Entry (whatever that is, exactly) "Email from local mail exhanger". I had to go in and change it to "Remote mail exchanger."
Doesn't solve the original problem with CGI, but I've followed two different PHP form to email tutorials (one being Nancy's) and both seemed to work, except no email. THIS switch did the trick!
Dave
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Nancy,
Ben pointed me out to a bootstrap tutorial of yours. That's all new to me, but I look forward to looking into that further.
I did work my way through your tutorial while trying to modify my Contact Me page. Didn't work, but when I just took your example it seems to work -- except that nothing comes through to my email.
Could it be because of my address on my web server? I'm not sure what it even is. I contacted GoDaddy but they were having technical difficulties and couldn't access my account. I guessed 'webmaster@daveharrison.info' -- if that's not it could that be why I'm not getting the form submissions?
//valid address on your web server
$from = 'webmaster@yourdomain.com ';
//your email address where you wish to receive mail
$to = 'you@yourdomain.com';
Thanks for any info on this.
Dave
Copy link to clipboard
Copied
Is this releveant/helpful?: https://uk.godaddy.com/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376
Copy link to clipboard
Copied
Copy link to clipboard
Copied