Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Web page forms

Options
  • 24-04-2006 2:21pm
    #1
    Closed Accounts Posts: 4,237 ✭✭✭


    just finishing off my web page and want to put an inquiry form on the contact page. i have the layout done and buttons etc... does anyone have code or what not necessary to make what i have on screen get emailed to a certain address. Even if someone can point me in the right direction.

    Thanks
    Graham


Comments

  • Closed Accounts Posts: 1,200 ✭✭✭louie


    what language are you using?
    PHP, ASP?


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    iregk wrote:
    just finishing off my web page and want to put an inquiry form on the contact page. i have the layout done and buttons etc... does anyone have code or what not necessary to make what i have on screen get emailed to a certain address. Even if someone can point me in the right direction.

    Thanks
    Graham

    Sample PERL Code:
    # means comment in every line except first
    
    
    #!/usr/bin/perl
    use CGI::Carp qw(fatalsToBrowser);
    use strict;
    use CGI ':standard';
    
    
    # Step 1: Parse form inputs which you should have called name, email and S1 in your html 
    my $name1      =  param('name');
    my $email1      =  lc(param('email')); # lc stands for lowercase
    my $text1        =  param('S1');
    
    
    
    my $to2 =$email1;             # Parses the email address which was stored as a hidden variable in the HTML form. 
    my $from2 ='you@yoursite.co.uk';    
             
    open(MAIL, "|/usr/lib/sendmail -t");               
    print MAIL "To: $to2 \nFrom: $from2\n";      	   
    print MAIL "Subject: Thank you $name1 for your query\n";       	    
    print MAIL "Hello $name1,\n\n This is an automated email to let you know that we have received an email with your form submission. We will respond asap to your request. Thanks for your interest in our site and visit us again at www.YOURSITE.COM .\n\nRegards,YOU\n\n Your Query\n\n$text1\n"; 
    close(MAIL);
    
    
    
    print "Content-type:text/html\n\n";	
    print <<EndHTML;
    
    
    Done - HTML GOES HERE
    
    
    EndHTML
    my $end1=1;
    
    
    

    If you are going to run it on your own PC with Windows/Apache etc then you need to chage the 1st line - let me know where you are going to host this. You must save it as a .pl or .cgi or something. You may have to change permissions to 755 if not already automatically done. This perl file will be placed inside your CGI bin on whatever server your using. Easy. The above script assumes a UNIX hosted server ie You are hosting this web site somewhere other than your own PC


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    If you're just doing it purely in html, you'll need to use frontpage server extensions (and have it on a server that supports them). The code would be somthing like
    <form method="POST" name="SurveyForm" action="_derived/nortbots.htm" onSubmit="location.href='_derived/nortbots.htm';return false;" webbot-action="--WEBBOT-SELF--" WEBBOT-onSubmit>
      <!--webbot bot="SaveResults" S-Email-Format="TEXT/PRE"
      S-Email-Address="name@server.ie" B-Email-Label-Fields="TRUE"
      B-Email-Subject-From-Field="FALSE" S-Email-Subject="Subject Here"
      S-Builtin-Fields startspan --><strong>[FrontPage Save Results Component]</strong><!--webbot bot="SaveResults" endspan i-checksum="6561" -->
      <p><label for="fp1">Name</label><input type="text" name="T1" size="20" id="fp1"></p>
      <p><label for="fp2">Company</label><input type="text" name="T2" size="20" id="fp2"></p>
        <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2">
    

    google should turn up loads of samples for frontpage extension email forms


Advertisement