cski2003 Posted August 2, 2007 Share Posted August 2, 2007 Hi im creating a php form so when a user come to my website and fills out questions like "how much would you like to spend", or "the product you would like to have is". so when all the questions are filled out and the put in their email address I can get back to them. I want the php to send me the form they just sent out to MY Email Address and i need the code to send them the same email that i got so they know what they filled out and they have it for their records also. does any one know a code to do that please some one help!!! Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/ Share on other sites More sharing options...
piznac Posted August 2, 2007 Share Posted August 2, 2007 It's customary to provide some code to show you have been working on this. But look up the "mail()" function ,.. that should get you started Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-313972 Share on other sites More sharing options...
cski2003 Posted August 2, 2007 Author Share Posted August 2, 2007 I have this code that i have from my Email form. all i need is to add a code so the email will go straight to them when they send it this is what i have so far.. <?php // read the variables form the string, (this is not needed with some servers). $subject = $_REQUEST["subject"]; $message = $_REQUEST["message"]; $sender = $_REQUEST["sender"]; // include sender IP in the message. $full_message = $_SERVER['REMOTE_ADDR'] . "\n\n" . $message; $message= $full_message; // remove the backslashes that normally appears when entering " or ' $message = stripslashes($message); $subject = stripslashes($subject); $sender = stripslashes($sender); // add a prefix in the subject line so that you know the email was sent by online form $subject = "Contact form ". $subject; // send the email, make sure you replace email@yourserver.com with your email address if(isset($message) and isset($subject) and isset($sender)){ mail("email@yourserver.com", $subject, $message, "From: $sender"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-313978 Share on other sites More sharing options...
piznac Posted August 2, 2007 Share Posted August 2, 2007 So you just need it to send to the orginal user as well? instead of doing this: mail("email@yourserver.com", $subject, $message, "From: $sender"); Define your "to" and add the $sender var to it. This should work,.. may not be the best way to do it but it has always worked for me. $to = "email@yourserver.com,$sender" mail($to, $subject, $message, "From: $sender"); ,.. is that what you are looking for? Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-313986 Share on other sites More sharing options...
cski2003 Posted August 2, 2007 Author Share Posted August 2, 2007 I need it to send to me and the original viewer. so it would me 'tome@myserver.com' and then "originalviewer@theirserver.com' Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-313994 Share on other sites More sharing options...
piznac Posted August 2, 2007 Share Posted August 2, 2007 Ok is $sender holding the email address from the orginal user? If so then that would work. Im assuming you are collecting the email address. Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-313996 Share on other sites More sharing options...
cski2003 Posted August 2, 2007 Author Share Posted August 2, 2007 Yes i would me holding the emails Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-314000 Share on other sites More sharing options...
piznac Posted August 2, 2007 Share Posted August 2, 2007 So that should work then: $to = "tome@myserver.com,$sender" mail($to, $subject, $message, "From: $sender"); Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-314004 Share on other sites More sharing options...
cski2003 Posted August 2, 2007 Author Share Posted August 2, 2007 thanks for the help i really appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/#findComment-314016 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.