Aloha Posted September 16, 2013 Report Posted September 16, 2013 My name is Sarah. I am new to php. I found a sample php script I'd like to use which sends user-entered data from an HTML form to another page, which gets processed there with php. But I don't know how to also get the form results emailed to me. Here's what I mean: Here's the HTML Form: <html><body> <h4>Tizag Art Supply Order Form</h4> <form action="process.php" method="post"> <select name="item"> <option>Paint</option> <option>Brushes</option> <option>Erasers</option> </select> Quantity: <input name="quantity" type="text" /> <input type="submit" /> </form> </body></html> Here's the php processing the form: <html><body> <?php $quantity = $_POST['quantity']; $item = $_POST['item']; echo "You ordered ". $quantity . " " . $item . ".<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; ?> </body></html> But I would also like to have the user entered data emailed to me. Can anyone help or show me how to do it? Thank you, Sarah Quote
cdacmarketing Posted September 17, 2013 Report Posted September 17, 2013 Hi Sarah; I think something like this would work. // send email Notification $to = "To: youremailaddress@your.domain"; $subject = "text written here appears in the subject head of the email"; $body = "Dear Sarah;\n Below are items we need, yada yada. Text written here will appear in the body of the email. Sincerely, -Us the salt mine workers\n\n ---Details about what your form captured can go here like this--- CUSTOMERS NAME: $name CUSTOMERS EMAIL: $email ---ABOUT YOUR ORDER--- QUANTITY: $quantity ITEM: $item"; $headers = "From: $email"; mail($to, $subject, $body, $headers); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.