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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post

    Send a Copy to Yourself in contact form

    I'll make a line to my contact form like (Send copy to yourself), how can I do that?
    Thank you for your hand

    here's my PHP code:

    <?php
    $mailTo = 'contact@site.com';
    $name = htmlspecialchars($_POST['Name']);
    $mailFrom = htmlspecialchars($_POST['Email']);
    $telefon = htmlspecialchars($_POST['Telefon']);
    $adresse = htmlspecialchars($_POST['Adresse']);
    $subject = htmlspecialchars($_POST['Subject']);
    $message_text = htmlspecialchars($_POST['Message']);
    $header = "From: ". $name . " <" . $mailFrom . ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message = 'Navn: '.$name.'
    E-post: '.$mailFrom.'
    Telefon: '.$telefon.'
    Adresse: '.$adresse.'
    Melding: '.$message_text;

    mail($mailTo, $subject, $message, $header);
    ?>

    _______________________________________________________________

    Here is HTML code:

    <!-- contact-form START here -->
    <div id="feedback">
    <p class="error wrong_name"> - Vennligst skriv inn ditt navn.</p>
    <p class="error wrong_email"> - Vennligst skriv inn din e-postadresse.</p>
    <p class="error wrong_message"> - Vennligst skriv inn din melding.</p>
    </div>
    <form action="sendemail.php" id="contact_us" method="post">
    <p class="label_name">Navn</p>
    <p class="input_form">
    <input type="text" name="Name" />
    </p>
    <p class="label_name">E-post</p>
    <p class="input_form">
    <input type="text" name="Email" />
    </p>
    <p class="label_name">Telefon</p>
    <p class="input_form">
    <input type="text" name="Telefon" />
    </p>
    <p class="label_name">Adresse</p>
    <p class="input_form">
    <input type="text" name="Adresse" />
    </p>
    <p class="label_name">Emne</p>
    <p class="input_form">
    <input type="text" name="Subject" />
    </p>
    <p class="label_name">Melding</p>
    <p class="input_form" id="textarea">
    <textarea name="Message" rows="10" cols="4" id="message_input"></textarea>
    </p>
    <p id="submit">
    <input type="submit" value="Send" name="submitButton" class="button" />
    </p>
    </form>
    <p id="success">Takk. Din melding ble sendt. Vi vil besvare din henvendelse så fort som mulig.</p>
    <!-- contact-form END here -->

    _______________________________________________________________

    Example: http://bildr.no/view/858937


    Thank you for help

  2. Users who have thanked sjaban for this post:

    dylan75 (04-11-2011)

  • #2
    New Coder
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    31
    Thanks
    0
    Thanked 9 Times in 8 Posts
    use [PHP] tags next time and try this (havent checked):
    PHP:
    PHP Code:
    <?php
    //Send copy - Start
    $copy 0;
    $copy mysql_real_escape_string($_POST['copy']);
    if(
    $copy == 1)
    {
    $mailTo htmlspecialchars($_POST['Email']);
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']);
    $telefon htmlspecialchars($_POST['Telefon']);
    $adresse htmlspecialchars($_POST['Adresse']);
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']);
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.'
    E-post: '
    .$mailFrom.'
    Telefon: '
    .$telefon.'
    Adresse: '
    .$adresse.'
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    }
    //Send copy -End

    $mailTo 'contact@site.com';
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']);
    $telefon htmlspecialchars($_POST['Telefon']);
    $adresse htmlspecialchars($_POST['Adresse']);
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']);
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.'
    E-post: '
    .$mailFrom.'
    Telefon: '
    .$telefon.'
    Adresse: '
    .$adresse.'
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    ?>
    HTML:
    Code:
    <!-- contact-form START here -->
    <div id="feedback">
    <p class="error wrong_name"> - Vennligst skriv inn ditt navn.</p>
    <p class="error wrong_email"> - Vennligst skriv inn din e-postadresse.</p>
    <p class="error wrong_message"> - Vennligst skriv inn din melding.</p>
    </div>
    <form action="sendemail.php" id="contact_us" method="post">
    <p class="label_name">Navn</p>
    <p class="input_form">
    <input type="text" name="Name" />
    </p>
    <p class="label_name">E-post</p>
    <p class="input_form">
    <input type="text" name="Email" />
    </p>
    <p class="label_name">Telefon</p>
    <p class="input_form">
    <input type="text" name="Telefon" />
    </p>
    <p class="label_name">Adresse</p>
    <p class="input_form">
    <input type="text" name="Adresse" />
    </p>
    <p class="label_name">Emne</p>
    <p class="input_form">
    <input type="text" name="Subject" />
    </p>
    <p class="label_name">Melding</p>
    <p class="input_form" id="textarea">
    <textarea name="Message" rows="10" cols="4" id="message_input"></textarea>
    </p>
    <p class="label_name">Send yourself a copy</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" /> 
    </p>
    <p id="submit">
    <input type="submit" value="Send" name="submitButton" class="button" />
    </p>
    </form>
    <p id="success">Takk. Din melding ble sendt. Vi vil besvare din henvendelse så fort som mulig.</p>
    <!-- contact-form END here -->

  • Users who have thanked tropane for this post:

    sjaban (04-07-2011)

  • #3
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by tropane View Post
    use [PHP] tags next time and try this (havent checked):
    PHP:
    PHP Code:
    <?php
    //Send copy - Start
    $copy 0;
    $copy mysql_real_escape_string($_POST['copy']);
    if(
    $copy == 1)
    {
    $mailTo htmlspecialchars($_POST['Email']);
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']);
    $telefon htmlspecialchars($_POST['Telefon']);
    $adresse htmlspecialchars($_POST['Adresse']);
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']);
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.'
    E-post: '
    .$mailFrom.'
    Telefon: '
    .$telefon.'
    Adresse: '
    .$adresse.'
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    }
    //Send copy -End

    $mailTo 'contact@site.com';
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']);
    $telefon htmlspecialchars($_POST['Telefon']);
    $adresse htmlspecialchars($_POST['Adresse']);
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']);
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.'
    E-post: '
    .$mailFrom.'
    Telefon: '
    .$telefon.'
    Adresse: '
    .$adresse.'
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    ?>
    HTML:
    Code:
    <!-- contact-form START here -->
    <div id="feedback">
    <p class="error wrong_name"> - Vennligst skriv inn ditt navn.</p>
    <p class="error wrong_email"> - Vennligst skriv inn din e-postadresse.</p>
    <p class="error wrong_message"> - Vennligst skriv inn din melding.</p>
    </div>
    <form action="sendemail.php" id="contact_us" method="post">
    <p class="label_name">Navn</p>
    <p class="input_form">
    <input type="text" name="Name" />
    </p>
    <p class="label_name">E-post</p>
    <p class="input_form">
    <input type="text" name="Email" />
    </p>
    <p class="label_name">Telefon</p>
    <p class="input_form">
    <input type="text" name="Telefon" />
    </p>
    <p class="label_name">Adresse</p>
    <p class="input_form">
    <input type="text" name="Adresse" />
    </p>
    <p class="label_name">Emne</p>
    <p class="input_form">
    <input type="text" name="Subject" />
    </p>
    <p class="label_name">Melding</p>
    <p class="input_form" id="textarea">
    <textarea name="Message" rows="10" cols="4" id="message_input"></textarea>
    </p>
    <p class="label_name">Send yourself a copy</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" /> 
    </p>
    <p id="submit">
    <input type="submit" value="Send" name="submitButton" class="button" />
    </p>
    </form>
    <p id="success">Takk. Din melding ble sendt. Vi vil besvare din henvendelse så fort som mulig.</p>
    <!-- contact-form END here -->
    Thank you dear tropane
    But not working, copy not going to sender :-(
    help pleas.

  • #4
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by sjaban View Post
    Thank you dear tropane
    But not working, copy not going to sender :-(
    help pleas.
    Anybody can help me please

  • #5
    New Coder
    Join Date
    Mar 2011
    Posts
    62
    Thanks
    3
    Thanked 2 Times in 2 Posts
    If it sends to everybody but yourself, why don't you just include yourself in the mailing list??

  • #6
    New Coder
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    31
    Thanks
    0
    Thanked 9 Times in 8 Posts
    hmm, try this :P
    PHP Code:
    $mailTo "contact@site.com, mysql_real_escape_string($_POST['Email'])"

  • #7
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by tropane View Post
    hmm, try this :P
    PHP Code:
    $mailTo "contact@site.com, mysql_real_escape_string($_POST['Email'])"
    Hello

    I do misunderstand, I like to say that, for example from the site contact form, you (or Sender) send an e-mail to me and sent a copy of the email to you (avsendr limbs) as well.
    not contact@site.com.
    Hope explained well enough :-)
    (Post going to contact@site.com but not going CC to sender problem is sender copy not working)
    Thanx for help
    Last edited by sjaban; 04-08-2011 at 04:52 PM.

  • #8
    New Coder
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    31
    Thanks
    0
    Thanked 9 Times in 8 Posts
    oh, I've mad a mistake in my code now... it should work..
    PHP Code:
    <?php
    if(isset($_POST['copy']) && $_POST['copy'] == 1)
    {
    $mailTo htmlspecialchars($_POST['Email']);
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']); 
    $telefon htmlspecialchars($_POST['Telefon']); 
    $adresse htmlspecialchars($_POST['Adresse']); 
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']); 
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.
    E-post: '
    .$mailFrom.
    Telefon: '
    .$telefon.
    Adresse: '
    .$adresse.
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    }

    $mailTo 'contact@site.com';
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']); 
    $telefon htmlspecialchars($_POST['Telefon']); 
    $adresse htmlspecialchars($_POST['Adresse']); 
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']); 
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.
    E-post: '
    .$mailFrom.
    Telefon: '
    .$telefon.
    Adresse: '
    .$adresse.
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    ?>
    Code:
    <!-- contact-form START here -->
    <div id="feedback">
    <p class="error wrong_name"> - Vennligst skriv inn ditt navn.</p>
    <p class="error wrong_email"> - Vennligst skriv inn din e-postadresse.</p>
    <p class="error wrong_message"> - Vennligst skriv inn din melding.</p>
    </div>
    <form action="sendemail.php" id="contact_us" method="post">
    <p class="label_name">Navn</p>
    <p class="input_form">
    <input type="text" name="Name" />
    </p>
    <p class="label_name">E-post</p>
    <p class="input_form">
    <input type="text" name="Email" />
    </p>
    <p class="label_name">Telefon</p>
    <p class="input_form">
    <input type="text" name="Telefon" />
    </p>
    <p class="label_name">Adresse</p>
    <p class="input_form">
    <input type="text" name="Adresse" />
    </p>
    <p class="label_name">Emne</p>
    <p class="input_form">
    <input type="text" name="Subject" />
    </p>
    <p class="label_name">Melding</p>
    <p class="input_form" id="textarea">
    <textarea name="Message" rows="10" cols="4" id="message_input"></textarea>
    </p>
    <p class="label_name">Send yourself a copy</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" /> 
    </p>
    <p id="submit">
    <input type="submit" value="Send" name="submitButton" class="button" />
    </p>
    </form>
    <p id="success">Takk. Din melding ble sendt. Vi vil besvare din henvendelse så fort som mulig.</p>
    <!-- contact-form END here -->

  • Users who have thanked tropane for this post:

    dylan75 (04-11-2011)

  • #9
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by tropane View Post
    oh, I've mad a mistake in my code now... it should work..
    PHP Code:
    <?php
    if(isset($_POST['copy']) && $_POST['copy'] == 1)
    {
    $mailTo htmlspecialchars($_POST['Email']);
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']); 
    $telefon htmlspecialchars($_POST['Telefon']); 
    $adresse htmlspecialchars($_POST['Adresse']); 
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']); 
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.
    E-post: '
    .$mailFrom.
    Telefon: '
    .$telefon.
    Adresse: '
    .$adresse.
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    }

    $mailTo 'contact@site.com';
    $name htmlspecialchars($_POST['Name']);
    $mailFrom htmlspecialchars($_POST['Email']); 
    $telefon htmlspecialchars($_POST['Telefon']); 
    $adresse htmlspecialchars($_POST['Adresse']); 
    $subject htmlspecialchars($_POST['Subject']);
    $message_text htmlspecialchars($_POST['Message']); 
    $header "From: "$name " <" $mailFrom ">\r\n";
    $header .= "Content-Type: text/plain; charset=\"UTF-8\"";


    $message 'Navn: '.$name.
    E-post: '
    .$mailFrom.
    Telefon: '
    .$telefon.
    Adresse: '
    .$adresse.
    Melding: '
    .$message_text;

    mail($mailTo$subject$message$header);
    ?>
    Code:
    <!-- contact-form START here -->
    <div id="feedback">
    <p class="error wrong_name"> - Vennligst skriv inn ditt navn.</p>
    <p class="error wrong_email"> - Vennligst skriv inn din e-postadresse.</p>
    <p class="error wrong_message"> - Vennligst skriv inn din melding.</p>
    </div>
    <form action="sendemail.php" id="contact_us" method="post">
    <p class="label_name">Navn</p>
    <p class="input_form">
    <input type="text" name="Name" />
    </p>
    <p class="label_name">E-post</p>
    <p class="input_form">
    <input type="text" name="Email" />
    </p>
    <p class="label_name">Telefon</p>
    <p class="input_form">
    <input type="text" name="Telefon" />
    </p>
    <p class="label_name">Adresse</p>
    <p class="input_form">
    <input type="text" name="Adresse" />
    </p>
    <p class="label_name">Emne</p>
    <p class="input_form">
    <input type="text" name="Subject" />
    </p>
    <p class="label_name">Melding</p>
    <p class="input_form" id="textarea">
    <textarea name="Message" rows="10" cols="4" id="message_input"></textarea>
    </p>
    <p class="label_name">Send yourself a copy</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" /> 
    </p>
    <p id="submit">
    <input type="submit" value="Send" name="submitButton" class="button" />
    </p>
    </form>
    <p id="success">Takk. Din melding ble sendt. Vi vil besvare din henvendelse så fort som mulig.</p>
    <!-- contact-form END here -->
    Hi
    thanks it worked, but how can fix this text in the right line?
    see picture: http://bildr.no/view/860696
    Her is my CSS code for contact form:

    /** Contact us Form **/

    #contact_us {width:460px; margin:25px 0px 0px; overflow:hidden;}

    #contact_us p.label_name, #contact_us p.input_form {float:left; margin-bottom:10px;}
    p.label_name {width:80px; clear:both; color:#404040; font-size:13px;}

    #contact_us input, #contact_us textarea {width:370px; background:#fff; border:#515151 1px solid; font-size:12px; padding:4px; margin-bottom:15px; color:#404040; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; font-family:"Lucida Sans Unicode", "Lucida Grande", Garuda, sans-serif;}
    #contact_us input.button {cursorointer; width:auto; float:right; font-size:12px;}

    #feedback p {margin-bottom:5px;}
    p.error {display:none; padding:5px 0px; color:#FF3300; font-size:13px; font-weight:normal;}
    p#submit {text-align:right;}
    p#success {display:none; font-size:14px; text-align:left; margin-bottom:20px; color:#00CC00; font-style:normal;}

    Thank you so much
    Last edited by sjaban; 04-09-2011 at 02:14 PM.

  • #10
    New Coder
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    31
    Thanks
    0
    Thanked 9 Times in 8 Posts
    Code:
    <p class="label_name">&nbsp;</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" />&nbsp;<span style="text-align:right;">Send yourself a copy</span>
    </p>

  • Users who have thanked tropane for this post:

    sjaban (04-09-2011)

  • #11
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by tropane View Post
    Code:
    <p class="label_name">&nbsp;</p>
    <p class="input_form">
    <input type="checkbox" name="copy" value="1" />&nbsp;<span style="text-align:right;">Send yourself a copy</span>
    </p>
    Thanx
    But look like this now: http://bildr.no/view/860811

  • #12
    New Coder
    Join Date
    Nov 2010
    Location
    United Kingdom
    Posts
    31
    Thanks
    0
    Thanked 9 Times in 8 Posts
    Code:
    <p class="label_name">&nbsp;</p>
    <p class="input_form">
    <input style="width:auto;" type="checkbox" name="copy" value="1" /> Send yourself a copy
    </p>

  • The Following 2 Users Say Thank You to tropane For This Useful Post:

    dylan75 (04-11-2011), sjaban (04-09-2011)

  • #13
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post

    Thank you

    Dear tropane
    Thank you for all help, problem is down.
    kindlig of you.

    have a nice weekend

  • #14
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Nice Post

  • #15
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sjaban View Post
    Hi
    thanks it worked, but how can fix this text in the right line?
    see picture: http://bildr.no/view/860696
    Her is my CSS code for contact form:

    /** Contact us Form **/

    #contact_us {width:460px; margin:25px 0px 0px; overflow:hidden;}

    #contact_us p.label_name, #contact_us p.input_form {float:left; margin-bottom:10px;}
    p.label_name {width:80px; clear:both; color:#404040; font-size:13px;}

    #contact_us input, #contact_us textarea {width:370px; background:#fff; border:#515151 1px solid; font-size:12px; padding:4px; margin-bottom:15px; color:#404040; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; font-family:"Lucida Sans Unicode", "Lucida Grande", Garuda, sans-serif;}
    #contact_us input.button {cursorointer; width:auto; float:right; font-size:12px;}

    #feedback p {margin-bottom:5px;}
    p.error {display:none; padding:5px 0px; color:#FF3300; font-size:13px; font-weight:normal;}
    p#submit {text-align:right;}
    p#success {display:none; font-size:14px; text-align:left; margin-bottom:20px; color:#00CC00; font-style:normal;}

    Thank you so much
    Thank you


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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