Jump to content

Copying results to email address


Recommended Posts

I am not an advanced user of PHP/MYSQL but I have gotten by on my pages using Dreamweaver. Currently I use the web-based PHP from my ISP and I would like to configure it so that when someone enters in data - it not only goes to my database, but copies me in email. Can someone give me an idea of how this might work?

 

Thanks ahead of time for your help

 

Ryan

http://www.godsandnemesis.com

Link to comment
https://forums.phpfreaks.com/topic/2486-copying-results-to-email-address/
Share on other sites

  • 3 weeks later...

The following code works for me (everything between dotted lines). The basic function is the mail function, and i have 4 variables that it takes, the $toaddress gets assigned your email address. $subject is what the subject header will be. $mailcontent is what will be in the body (the trickiest part) and $fromaddress is what will appear as the sender (you can leave this out if you want).

 

------------------------------------------------------------------------

// create variables from form

$firstname = $_POST[Firstname];

$lastname = $_POST[Lastname];

$date = $_POST[Date];

$request = $_POST[Request];

$email = $_POST;

 

 

// send email

$toaddress = '[email protected]';

$subject = 'Email Subject Line Here';

$mailcontent = $firstname.' '.$lastname"\n"$date"\n"$request;

$fromaddress = 'From: '.$email;

mail($toaddress, $subject, $mailcontent, $fromaddress);

 

-------------------------------------------------------------------------

 

This might look complicated, email me if it's unclear: [email protected]

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.