boxturt Posted March 6, 2005 Posted March 6, 2005 (edited) Greetings and salivations, um - salutations? Yea - that's it. I have a basic form on a site that uses php to put the info into a mysql table. Form gets filled out, click to submit ( <form .... method="post" action="/dothis.php" onsubmit="return checkform(this) && checkCheckBoxes(this) && isValid();"...etc> )and no further action is required on the users part. The info reappears on the thankyou page and the info goes into database for display elsewhere. I know - nothing new here. Or here, but my question : is there an easy method to get an email sent to me when that form is submitted? (I'm having one of those "I know I've seen it somewhere.." moments...) Thanks [edit] I should say easy and safe method Edited March 6, 2005 by boxturt Quote
TCH-Don Posted March 6, 2005 Posted March 6, 2005 Since the info is sent to a thank you page why not use php mail() to send the info to yourself just before going to the thank you page <?php mail($myemail, $subject, $message, $from); ?> You can set $message equal to all the data you need to see. Quote
boxturt Posted March 6, 2005 Author Posted March 6, 2005 Thanks Don You can set $message equal to all the data you need to see. I'm having trouble making this work. Defining $message that is. I tried putting everything in here first (predefining $myemail and $subject earlier) : ><?php mail($myemail, $subject, $first_name, $last_name, $phone, $email); ?> but it ceased to work after adding the 5th ($last_name) element. I tried predefining $message as an array also (which is probably just wrong anyway ) and that didn't work either. I shuld mention though that it does indeed work up to that point. Quote
stevevan Posted March 7, 2005 Posted March 7, 2005 Ty: what about Ultimate Form Mail? Would this work for your particular application? Quote
TCH-Don Posted March 7, 2005 Posted March 7, 2005 No you need to keep the format <?php mail($myemail, $subject, $message, $from); ?> So try this using Heredoc to build the $message ><?php $myemail ="me@mysite"; $subject = "new database entry"; $message = <<< EOF New entry to database Name: $first_name $last_name Phone: $phone email: $email EOF; $from = "From: $email\r\n"; // send mail mail($myemail, $subject, $message, $from); ?> Quote
boxturt Posted March 7, 2005 Author Posted March 7, 2005 Thanks - I'll try that. This is sooooo close to what I kept calling "predefining". This is page 74 of my O'Reilly's too. Sitting right here next to me and I didn't find it. Durr Thanks for the suggestion Steve, I'm not sure UFM would work for this but I may end up revisiting the option. (I think only the paid version writes to database, not sure) Quote
Head Guru Posted March 7, 2005 Posted March 7, 2005 Boxturt, Thanks for the card. I really enjoyed reading it. My son is using the pick everyday to play. Bill Quote
boxturt Posted March 7, 2005 Author Posted March 7, 2005 You're welcome - thank you!! I'm glad he's giving it a try BTW - the ' HEREDOC ' did the trick, thank you. I like php and I know I'll be better at it once I learn what things are called!! 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.