Jump to content


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


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




Share this post

Link to post
Share on other sites

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 = 'you@yourdomain.com';

$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: dunkley@dunkleybrown.com


Share this post

Link to post
Share on other sites


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.