www.webdeveloper.com
Results 1 to 4 of 4

Thread: Information on FORMS for Feedback or Contact Pages - Updated!

  1. #1
    Join Date
    Nov 2002
    Location
    Hermantown, MN
    Posts
    1,777

    Information on FORMS for Feedback or Contact Pages

    Want to save information from a form to a file or email it to yourself? You can't use HTML for this, you need a server side languages. There are many such languages that you can use, like PHP, ASP, ASP.net, CGI-Perl, JSP, ColdFusion, ect.

    First, find out what your host supports and then you can learn the apporpriate language.

    If your just starting out I suggest making your post in the CGI-Perl forum.

    Thank you,
    Compguy Pete
    Share on Google+

  2. #2
    Join Date
    Sep 2003
    Location
    Portsmouth, UK Occupation: Web Developer
    Posts
    2,602
    For any form action you need a server side technology, the most common is a form mailer, this takes the results of a form and mails it to the address specified.

    Not all servers/hosting support server side technologys, but there are many free form mailers available on the net for you to use.

    I recommend using this script if you server does not support a server side technology (Coded by me)
    Original Source
    PHP Code:
    //Dont forget to replace the email and thankyou page to your own
    <form action="http://php.richardturner.com/mailer.php" method="post">
    <
    p>
    <
    input type="hidden" name="form_email" value="YOUR_EMAIL@DOMAIN" /><br />
    <
    input type="hidden" name="form_thankyou" value="http://www.YOURSITE.com/THANKYOUPAGE.HTML" /><br />
    Your Form Here<br />
    <
    input type="submit" value="Submit" />
    </
    p>
    </
    form
    or if you server supports PHP (Coded by pyro )
    Original Source
    PHP Code:
    <?PHP

    #######################################################
    # This script is Copyright 2003, Infinity Web Design  #
    # Distributed by [url]http://www.webdevfaqs.com[/url]            #
    # Written by Ryan Brill                               #
    # All Rights Reserved - Do not remove this notice     #
    #######################################################

    ## The lines below need to be edited...

    ###################### Set up the following variables ######################
    #
    $to "you@your.com"#set address to send form to
    $subject "Results from your Request Info form"#set the subject line
    $headers "From: Form Mailer"#set the from address, or any other headers
    $forward 0# redirect? 1 : yes || 0 : no
    $location "thankyou.htm"#set page to redirect to, if 1 is above
    #
    ##################### No need to edit below this line ######################

    ## set up the time ##

    $date date ("l, F jS, Y");
    $time date ("h:i A");

    ## mail the message ##

    $msg "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

    if (
    $_SERVER['REQUEST_METHOD'] == "POST") {
        foreach (
    $_POST as $key => $value) {
            
    $msg .= ucfirst ($key) ." : "$value "\n";
        }
    }
    else {
        foreach (
    $_GET as $key => $value) {
            
    $msg .= ucfirst ($key) ." : "$value "\n";
        }
    }

    mail($to$subject$msg$headers);
    if (
    $forward == 1) {
        
    header ("Location:$location");
    }
    else {
        echo 
    "Thank you for submitting our form. We will get back to you as soon as possible.";
    }

    ?>
    or if you server supports ASP
    //Coming Soon EDIT: See Below Post By Dave//
    Last edited by 96turnerri; 12-06-2004 at 06:12 PM.
    Share on Google+

  3. #3
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    Well as Rich said, ASP solution coming soon so here it is. I've made an example form in HTML Strict 4.01 and there's also the script itself in a separate .asp file.

    It's pretty simple to use, the form submits to the ASP file which processes the info and then redirects the user to another page. All you have to do is open up the ASP file in notepad and fill in values for 3 variables:
    Code:
    SMTPserver	= "xxx.xxx.xxx.xxx"		' Specify a valid SMTP mail server.
    redir		= "http://www.w3.org/"		' Specify a page to redirect the user to once they have submitted the form.
    recipient	= "email@address.com"		' Specify who to send the email to.
    Attached Files Attached Files
    Last edited by David Harrison; 03-15-2006 at 01:56 AM.
    Every fight is a food fight when you’re a cannibal.
    Share on Google+

  4. #4
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Note, the Persits AspEmail component must be installed and configured on the server for the ASP example to work. AspEmail is available on most modern Windows Servers. See the Persits Web Site for more information.

    Regards.
    Share on Google+

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles