Java Script Problem

Status
Not open for further replies.

fivemyer

New Member
Messages
6
Reaction score
0
Points
0
I was wondering if anyone knew the best way to have a form submission emailed to me is? I have a simple form on my site, and when the user hits submit, I would like to have both of us emailed the results.

I was able to achieve this earlier this year, using some feature here (sendmail...maybe?) but I have since forgotten what it was, and I accidentally deleted my work. I remember that I had a template for the email saved as a text file in the same directory, and that I had to use a hidden field to link them. Any one know how to do this? Thank you...
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
I would suggest PHP. I think there is a topic floating around the in the web and programming section.
 

fivemyer

New Member
Messages
6
Reaction score
0
Points
0
Some how I did use that before. There was some directory on my website that I pointed the form to (yet again I don't remember the name), and linked in the text file in the hidden field. Then whenever someone hit the send button it, emailed me the text file, with all of the variable where I needed them.

I will take a look on that forum, thank you for the help.
 

jtwhite

Community Advocate
Community Support
Messages
1,381
Reaction score
30
Points
0
I'd suggest PHP mail.

PHP:
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

You can learn more here: http://us3.php.net/manual/en/function.mail.php

If you don't remember how to get POST variables, you get them like this (make sure the form is submitting with the POST method):

PHP:
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
 
Last edited:
Status
Not open for further replies.
Top