I have a little guestbook script. Visitors use a form to add their comments, their info and comments are written to a database, and they get displayed on a seperate page. Now I would like to have the script send an email to the admin whenever a new comment is posted. Can someone help me out? Greetz! Mieke
The simplest solution would be to add something like this: $to = "ENTER_YOUR_EMAIL"; $subj = "ENTER_YOUR_SUBJECT"; $guest = GET_GUEST_NAME_FROM_SUBMIT_FORM; $msg = GET_GUEST_MESSAGE_FROM_SUBMIT_FORM; $message = $guest." wrote:\n\n".$msg; $header = "From: $to\n"; mail($to, $subj, $message, $header); PHP: You will of course need to replace GET_GUEST_NAME_FROM_SUBMIT_FORM, GET_GUEST_MESSAGE_FROM_SUBMIT_FORM with actual variables that holds that data. I suggest you google for php mail() tutorial and look a little deeper.