I have incorporated forms into sites I have built before but it was a long time ago. I would like to use forms again (on the page--> www. perryalanproductions.com/estimates.htm ) but I'm having a hard time finding a real simple form that will send the info to an email address and then direct the user to another html page. Can anyone suggest something that they know works and is simple? Thank you!!
Announcement
Collapse
No announcement yet.
Forms
Collapse
X
-
You can find some really easy and nicely done cgi form mailing scripts at www.cgi-resources.com
go to the perl sectionLast edited by ACJavascript; Jun 17, 2002, 08:57 PM.CYWebmaster.com - See why we dot com!!
ACJavascripts.com - Cut & Paste Javascripts!
SimplyProgram.com - Personal Blog
Comment
-
or you can use this one, just upload it to your cgi-bin, in acsii mode and chmod it 755, then all the info on the forms will be sent to the correponding mail.
Code:#!/usr/bin/perl ### ## # This script was creted by # Calilo ([email protected]) # Any questions or sugestions warmly received ## ### $sendmail = "/usr/sbin/sendmail"; # Where is sendmail? $to = "[email protected]"; # Who is going to receive the mail. $from = "My Mail sender"; # From who the mail is sended. $Subject = "Mail"; # The Mail's Subject. $location = "http://www.whereever.com"; # The page to be redirect after the mail was sended. ### # Rest of the "Escri" read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'}); open (MAIL, "|$sendmail $to") || die "Can't open $sendmail!\n"; print MAIL ("To: $to\n"); print MAIL ("From: $from\n"); print MAIL ("Subject: $subject\n\n"); # Process info from Fill in Form @namevalues = split(/&/, $namevalues); foreach $namevalue (@namevalues) { ($name, $value) = split(/=/, $namevalue); $name =~ tr/+/ /; $value =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $INPUT{$name} = $value; unless ($value eq "") { print MAIL ("$name: $value\n"); } } close (MAIL); print ("Location: $location\n"); exit;
Last edited by Calilo; Jun 17, 2002, 11:30 PM.
Comment
-
If you are using an FTP program then just upload the script in ACSII mode. Want's it uploaded then rightclick on it and click Set Permesions. The textbox usauly has 664 in it. Just type in 755 and hit okay.
Just thought i should say that just incase he/she was using a ftp programCYWebmaster.com - See why we dot com!!
ACJavascripts.com - Cut & Paste Javascripts!
SimplyProgram.com - Personal Blog
Comment
-
Have just found this thread, and am trying to implement the script, but without success.
Here's my HTML doc:
<html>
<head>
<title>Feedback Form</title>
</head>
<body>
<form method="POST" action="http://www.mydomain.net/cgi-bin/form.cgi">
user_email<br>
<input type="text" name="t1" size="20"><p>
<input type=submit value=Submit></form>
</body>
</html>
and I'm using the script above, as form.cgi...
#!/usr/bin/perl
###
##
# This script was creted by
# Calilo ([email protected])
# Any questions or sugestions warmly received
##
###
$sendmail = "/usr/sbin/sendmail"; # Where is sendmail?
$to = "[email protected]"; # Who is going to receive the mail.
$from = "My Mail sender"; # From who the mail is sended.
$Subject = "Mail"; # The Mail's Subject.
$location = "http://www.mydomain.net/after.html"; # The page to be redirect after the mail was sended.
###
# Rest of the "Escri"
read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
open (MAIL, "|$sendmail $to") || die "Can't open $sendmail!\n";
print MAIL ("To: $to\n");
print MAIL ("From: $from\n");
print MAIL ("Subject: $subject\n\n");
# Process info from Fill in Form
@namevalues = split(/&/, $namevalues);
foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
unless ($value eq "") {
print MAIL ("$name: $value\n");
}
}
close (MAIL);
print ("Location: $location\n");
exit;
I've got a feeling I need to change the line:
$sendmail = "/usr/sbin/sendmail"; # Where is sendmail?
but I'm guessing
Comment
-
maybe you have to change that line, it all depends on where sendmail, is located on youre server, you can ask the server admin for this info, or if you are running from unix, you can type whereis sendmail, and it should tell you, jsut copy that line and put it between the ""
that should make the script work.
calilo
Comment
-
Code:#!/usr/bin/perl ### ## # This script was creted by # Calilo ([email protected]) # Any questions or sugestions warmly received ## ### ### ## $sendmail = '/usr/sbin/sendmail'; # Where is sendmail? $to = '[email protected]'; # Who is going to receive the mail. $from = 'My Mail sender'; # From who the mail is sended. $subject = 'Mail'; # The Mail's Subject. $location = 'http://www.mydomain.net/after.html'; # The page to be redirect after the mail was sended. ## ### ### ## read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'}); open (MAIL, "|$sendmail $youmail") || die "Can't open $sendmail!\n"; print MAIL ("To: $to\n"); print MAIL ("From: $from\n"); print MAIL ("Subject: $subject\n\n"); # Process info from Fill in Form @namevalues = split(/&/, $namevalues); foreach $namevalue (@namevalues) { ($name, $value) = split(/=/, $namevalue); $name =~ tr/+/ /; $value =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $INPUT{$name} = $value; unless ($value eq "") { print MAIL ("$name: $value\n"); } } close (MAIL); print ("Location: $location\n\n"); exit; ## ###
ok thers the script again remember to upload it in ascii and chmod it 755, also to put a backslash before every @ on the mail addresses otherwise it wont work,
and if the script isnt redirecting to the thankyou page try changing the redirect line to this:
print ("Location: http://www.mydomain.com/after.html\n\n");
some serves dont let you have a var, there, strange, hope this solves the prob, i think the other script had some missing things.
Calilo
Comment
-
Comment
Comment