Results 1 to 8 of 8

Thread: Email form and response - how do I create both?

  1. #1
    Join Date
    May 2009
    Location
    Dallas, Texas
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Email form and response - how do I create both?

    Forgive me if this has been answered; I was unable to find an answer searching here.

    I'm trying to build a form that would generate two emails at the same time: one to the webmaster (the intended recipient) and the second to the person who filled out the form. Help?
    Last edited by mike_g; 05-27-2009 at 03:54 PM. Reason: more information

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Since I want to reduce the amount of modification required to your script can you please put up what you have so far?

  3. #3
    Join Date
    May 2009
    Location
    Dallas, Texas
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You betcha:

    <form id="contact" name="contact" method="post" action="/webformmailer.php">

    <strong>Name*</strong><br />
    <input name="name" type="text" id="name" size="40" maxlength="50" />
    </p>

    <p><strong>Email*</strong><br />
    <input name="email" type="text" id="email" size="40" maxlength="55" />
    </p>

    <p><strong>Message*</strong><br />
    <textarea name="message" cols="37" rows="7" id="message"></textarea>

    *= required</p>

    <p><label><input type="submit" name="send" id="send" value="Send Message" />
    </label></p>
    </form>

  4. #4
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    I don't know anything about webformmailer, but a lot of these scripts have the ability for a cc field to be passed so that you can send the email to 2 addresses.

    If it doesn't have that ability then I would suggest that you look for one that does have this, or write your own, they are fairly simple for a basic email.

    If however you want to have an HTML type email, ie the email is received in a 'formatted' state, eg can look like the input screen, then you need to use something more advanced, like Tectite Formmail.

  5. #5
    Join Date
    May 2009
    Location
    Dallas, Texas
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @ forum_amnesiac

    The webmailer is part of the hosting service; I'll check to see if it has a CC. Just in case, can you point me to some of that fairly basic code if I need to bypass it?

    Thanks for your help!

  6. #6
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    This is a small script that I use to receive the contents of an enquiry form in a simple format.

    It is very easy to use, just save this script as a PHP file, then in your HTML form use method="POST" action="scriptname.php".

    You can add HTML insde the script to say "Thank You", or you can redirect to another page.

    PHP Code:
        <?php
        
    //variables
        
        //form contents
        
    $txtName=$_POST['name'];
        
    $txtCategory=$_POST['category'];
        
    $txtCompany=$_POST['company'];
        
    $txtTel=$_POST['telephone'];
        
    $txtEmail=$_POST['email'];
        
    $txtRequest=$_POST['request'];
        
    $txtName str_replace(array("\n","\r"),'',$txtName); 
        
    $txtEmail str_replace(array("\n","\r"),'',$txtEmail);
        
    $txtCC="copyaddress@wherever.com";
        
    $txtBCC="hiddenaddress@wherever.com";
        
    $txtMyemail="myemail@wherever.com";


    $message "Category :\t$txtCategory\n
            \nCompany :\t
    $txtCompany\n
            \nName :\t
    $txtName\n
            \nTelephone :\t
    $txtTel\n
            \nEmail :\t
    $txtEmail\n
            \nRequest :\t
    $txtRequest\n
            \n"

    $subject "Request For Information - $txtName - $txtCompany"
    $mailheaders "From: $txtEmail <> \n"
    $mailheaders .= "Reply-To: $txtEmail\n\n"
    $mailheaders .= "CC: ".$txtCC."\n\n";
    $mailheaders .= "BCC: ".$txtBCC."\n\n";

    $sendemail =$txtMyemail;

        
    //send mail
        
    mail($sendemail$subject$message ,  $mailheaders);
        
    ?>
    You can add whatever other field values, from your form, you want into $message as long as they are converted to PHP variables using the $_POST method shown in the script.

    To send a copy to the person who filled out the form you would put their email address into the $txtCC variable.

    The email is not formatted in any way, it is just a 2 column list of descriptions and entered values.

  7. #7
    Join Date
    May 2009
    Location
    Dallas, Texas
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @ forum_amnesiac,

    Thanks, this looks awesome. One more question, is it possible to add a custom message to the CC or BCC?

  8. #8
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    No, the message content has to be the same for all email addresses

Bookmarks

Posting Permissions

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