Web Analytics Made Easy -
StatCounter Forms - CodingForum

Announcement

Collapse
No announcement yet.

Forms

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forms

    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!!

  • #2
    The most effective form scripts are done in a serverside language. What do you have available to you?

    Perl(CGI)?
    PHP?
    other?

    Comment


    • #3
      Perl (CGI)

      Comment


      • #4
        You can find some really easy and nicely done cgi form mailing scripts at www.cgi-resources.com

        go to the perl section
        Last edited by ACJavascript; Jun 17, 2002, 09:57 PM.
        CYWebmaster.com - See why we dot com!!
        ACJavascripts.com - Cut & Paste Javascripts!
        SimplyProgram.com - Personal Blog

        Comment


        • #5
          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;
          Calilo
          Last edited by Calilo; Jun 18, 2002, 12:30 AM.

          Comment


          • #6
            Originally posted by Calilo
            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.

            How do I chmod it??

            Comment


            • #7
              When he said chmod, he was assuming that you are running off of unix. Are you?

              If you're running off of Unix, you need to go to the location of the file you saved Calilo's script in and type at the prompt:

              Code:
              chmod caliloscript.pl 755
              -Obiwan Jabroni
              May the Schwartz be With You

              Comment


              • #8
                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 program
                CYWebmaster.com - See why we dot com!!
                ACJavascripts.com - Cut & Paste Javascripts!
                SimplyProgram.com - Personal Blog

                Comment


                • #9
                  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


                  • #10
                    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


                    • #11
                      I've managed to get this script to work - sort of.

                      It is sending the mail, but is still delivering a server 500 error when the form is submitted.

                      Any ideas?

                      Comment


                      • #12
                        Code:
                        #!/usr/bin/perl
                        
                        ###
                        ##
                        #     This script was creted by                                  
                        #     Calilo ([email protected]l.com)
                        #     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


                        • #13
                          I got the problem sorted out at another forum...

                          http://www.webmasterworld.com/forum13/1929.htm

                          Comment


                          • #14
                            Hey Thanks a lot for letting me know, what was wrong, any other thing I can help just let me know, specially if it is a cool perl project.

                            Calilo

                            Comment


                            • #15
                              Rizvan Is Great

                              dfdfsdf

                              Comment

                              Working...
                              X