Enjoy an ad free experience by logging in. Not a member yet?
Register .
04-07-2011, 06:44 PM
PM User |
#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
Users who have thanked sjaban for this post:
04-07-2011, 07:21 PM
PM User |
#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:
04-07-2011, 07:56 PM
PM User |
#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
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.
04-07-2011, 09:51 PM
PM User |
#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
Thank you dear tropane
But not working, copy not going to sender :-(
help pleas.
Anybody can help me please
04-07-2011, 11:55 PM
PM User |
#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??
04-08-2011, 12:10 AM
PM User |
#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'])" ;
04-08-2011, 03:05 PM
PM User |
#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
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 03:52 PM ..
04-08-2011, 08:35 PM
PM User |
#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:
04-09-2011, 12:11 PM
PM User |
#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
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 {cursor
ointer; 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 01:14 PM ..
04-09-2011, 02:36 PM
PM User |
#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"> </p>
<p class="input_form">
<input type="checkbox" name="copy" value="1" /> <span style="text-align:right;">Send yourself a copy</span>
</p>
Users who have thanked tropane for this post:
04-09-2011, 03:10 PM
PM User |
#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
Code:
<p class="label_name"> </p>
<p class="input_form">
<input type="checkbox" name="copy" value="1" /> <span style="text-align:right;">Send yourself a copy</span>
</p>
Thanx
But look like this now:
http://bildr.no/view/860811
04-09-2011, 05:11 PM
PM User |
#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"> </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:
04-09-2011, 06:17 PM
PM User |
#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
04-11-2011, 05:16 PM
PM User |
#14
New to the CF scene
Join Date: Apr 2011
Posts: 8
Thanks: 4
Thanked 0 Times in 0 Posts
Nice Post
10-18-2012, 08:40 AM
PM User |
#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
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 {cursor
ointer; 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
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 06:13 PM .
Advertisement
Log in to turn off these ads.