Jump to content


Copying results to email address

  • Please log in to reply
1 reply to this topic

#1 gatekeeper

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 06 September 2005 - 03:02 PM

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


#2 dunkleybrown

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 September 2005 - 11:21 PM

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[Email];

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users