Jump to content

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 = '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

 

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.