Re: Help with mail() function
| From: | Russell Shaw | Date: | Tue, 03 Feb 2004 01:22:57 +0000 |
| Subject: | Re: Help with mail() function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176641@lists.php.net to get a copy of this message | ||
Pooya Eslami wrote:
Hi, I'm new to php and this newsletter. I have a form on my webpage and a php file to email it to me but the contents of the text area are not emailed to me. Can anyone help me with this? here is the code for my html and php files: <html> <head><title>Test</title></head> <body> <form action="textareamail.php" method="POST"> Comments: </br> <textarea rows="10" cols="50" name="TextArea"></textarea> </br> <input type="reset" value="Clear"> <input type="submit" value="Submit"> </form> </body> </html> <?php if ($TextArea="") { echo "You have to fill out the entire form, go back and try again."; } else { $to = "me@myemailaddress.com"; $from = "From-Test"; $subject = "Subject-Test"; $message = "$TextArea";$message=$_POST[TextArea];
mail($to, $subject, $message,"From: $from"); echo "Thankyou"; } ?>A better way (imo) is to do it as javascript and pop up a window with the message. No server-side processing is then needed until a successful message is submitted.