Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15

Thread: Forms

  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 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
    Regular Coder
    Join Date
    Jun 2002
    Location
    Canada
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The most effective form scripts are done in a serverside language. What do you have available to you?

    Perl(CGI)?
    PHP?
    other?

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Perl (CGI)

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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; 06-18-2002 at 01:57 AM.
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mex
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 (Calilo_@Hotmail.com)
    #     Any questions or sugestions warmly received
    ## 
    ###
    
    $sendmail = "/usr/sbin/sendmail"; # Where is sendmail?
    $to = "You@you.com"; # 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; 06-18-2002 at 04:30 AM.

  • #6
    New Coder
    Join Date
    Jun 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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??

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #9
    New Coder
    Join Date
    Sep 2002
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 (Calilo_@Hotmail.com)
    # Any questions or sugestions warmly received
    ##
    ###

    $sendmail = "/usr/sbin/sendmail"; # Where is sendmail?
    $to = "myname@hotmail.com"; # 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

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mex
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #11
    New Coder
    Join Date
    Sep 2002
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mex
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    #!/usr/bin/perl
    
    ###
    ##
    #     This script was creted by                                  
    #     Calilo (Calilo_@Hotmail.com)
    #     Any questions or sugestions warmly received
    ## 
    ###
    
    ###
    ##
    $sendmail = '/usr/sbin/sendmail'; # Where is sendmail?
    $to = 'myname@hotmail.com'; # 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

  • #13
    New Coder
    Join Date
    Sep 2002
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got the problem sorted out at another forum...

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

  • #14
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mex
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #15
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Raipur
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape Rizvan Is Great

    dfdfsdf


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •