Advanced Search

Results 1 to 5 of 5

Thread: Sending email confirmation

  1. #1
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Sending email confirmation

    Hi

    I have a fill-out form on a html page that runs by a php script.
    On the html page I have 2 checkboxes under the fill-out form;
    1. send a copy of this message to my address
    2. Newsletter subscription

    When the first one is checked I would need a message to be sent to the sender with a subject: "Copy of your sent contact message"

    Is it possible to ad something into this script.

    Would appreciate your help, thanks!

    Code of the php script
    Code:
    <?
    $subject="from ".$_GET['Name'];
    $headers= "From: ".$_GET['e-mail']."\n";
     $headers.='Content-type: text/html; charset=iso-8859-1';
    mail("my.mail@email.com", $subject ="Contact message", "
    <html>
    <head>
     <title>Contact message</title>
    </head>
    <body>
    
    <br>
      ".$_GET['Name']."
      ".$_GET['Surrname']."
    <br>  
      ".$_GET['Address']."
    <br>  
      ".$_GET['Post.Nr']."
      ".$_GET['City']."
    <br>  
      ".$_GET['Telephone']."
    <br>  
      ".$_GET['e-mail']."
    <br>
    <br>
      ".$_GET['Newsletter_confirmation']."
    <br>  
    <br>    
      ".$_GET['Message']."
    </body>
    </html>" , $headers);
    ?>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    window.location.href = "http://www.feltne.com/oddano_s.htm";
    //-->
    </script>

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    PHP Code:
    <?php

    if(isset($_GET['sendMail'])) {

    $subject="from ".$_GET['Name'];
    $headers"From: ".$_GET['e-mail']."\n";
     
    $params.='Content-type: text/html; charset=iso-8859-1';
    mail("my.mail@email.com""Contact message""
    <html>
    <head>
     <title>Contact message</title>
    </head>
    <body>

    <br>
      "
    .$_GET['Name']."
      "
    .$_GET['Surrname']."
    <br>  
      "
    .$_GET['Address']."
    <br>  
      "
    .$_GET['Post.Nr']."
      "
    .$_GET['City']."
    <br>  
      "
    .$_GET['Telephone']."
    <br>  
      "
    .$_GET['e-mail']."
    <br>
    <br>
      "
    .$_GET['Newsletter_confirmation']."
    <br>  
    <br>    
      "
    .$_GET['Message']."
    </body>
    </html>" 
    $headers);
    ?>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    window.location.href = "http://www.feltne.com/oddano_s.htm";
    //-->
    </script>
    ", $headers, $params);

    }

    ?>
    <html>
    <head>
    </head>
    <body>
    <input type="checkbox" id="conf">
    <label for="conf">Send an email confirmation</label>
    </body>
    </html>
    HTH
    - Josh

  3. #3
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, thanks for your help.

    It gives me an error in the last line

    Parse error: syntax error, unexpected '<' in /home/feltne/public_html/contact.php on line 46

  4. #4
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    PHP Code:
    <?php

    if(isset($_GET['sendMail'])) {

    $subject="from ".$_GET['Name'];
    $headers"From: ".$_GET['e-mail']."\n";
     
    $params.='Content-type: text/html; charset=iso-8859-1';
    mail("my.mail@email.com""Contact message""
    <html>
    <head>
     <title>Contact message</title>
    </head>
    <body>

    <br>
      "
    .$_GET['Name']."
      "
    .$_GET['Surrname']."
    <br>  
      "
    .$_GET['Address']."
    <br>  
      "
    .$_GET['Post.Nr']."
      "
    .$_GET['City']."
    <br>  
      "
    .$_GET['Telephone']."
    <br>  
      "
    .$_GET['e-mail']."
    <br>
    <br>
      "
    .$_GET['Newsletter_confirmation']."
    <br>  
    <br>    
      "
    .$_GET['Message']."
    </body>
    </html>" 
    $headers$params);

    }

    ?>
    <html>
    <head>
    <script type="text/javascript">
    <!--
    function pstPg() {
        location.href='<?php echo $_SERVER['PHP_SELF']."?sendMail=True"?>';
    }
    //-->
    </script>
    </head>
    <body>
    <input type="checkbox" id="conf" onclick="pstPg()">
    <label for="conf">Send an email confirmation</label>
    </body>
    </html>
    - Josh

  5. #5
    Join Date
    Aug 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    JShor thanks, was not quite the way I wanted it, so I removed the checkbox button and just changed the code. So that I receive the data from fill-out form and the sender recieves a confirmation mail with some explenation.

    Code:
    <?
    $subject="from ".$_GET['name'];
    $headers= "From: ".$_GET['e-mail']."\n";
     $headers.='Content-type: text/html; charset=iso-8859-1';
    mail("info@somemail.com", $subject ="Contact message","
    <html>
    <head>
     <title>Contact message</title>
    </head>
    <body>
    
    <br>
      ".$_GET['name']."
      ".$_GET['surrname']."
    <br>  
      ".$_GET['address']."
    <br>  
      ".$_GET['post.code']."
      ".$_GET['city']."
    <br>  
      ".$_GET['telephone']."
    <br>  
      ".$_GET['e-mail']."
    <br>
    <br>
      ".$_GET['checkbox1']."
    <br>  
    <br>    
      ".$_GET['message']."
    </body>
    </html>" , $headers);
    ?>
    
    <?
    $to = $_GET['e-mail'];
    $message = "Thank you message.<br>We will try to answer you in a short time!<br><br>Someone.com";
    $subject = "Message confirmation - Someone.com";
    $header  = "From: info@somemail.com (Someoen.com)\r\n";
     $header .= "Content-Type: text/html\r\nContent-Transfer-Encoding: 8bit";
    mail($to, $subject, $message, $header);
    ?>
    
    <script language="JavaScript" type="text/JavaScript">
    <!--
    window.location.href = "http://www.feltne.com/oddano_s.htm";
    //-->
    </script>

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
  •