Jump to content

Recommended Posts

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!!! 

Link to comment
https://forums.phpfreaks.com/topic/63040-solved-email-to-email-information-form/
Share on other sites

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");

}

?>

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?

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.