How to create Mail-to Form?
# May 22, 2013 at 4:28 am
So I’m currently using the form given here:
It’s a CSS form, I’ve customised it in terms of design.. But I can’t find a way to make the form send an Email using PHP.
Also, when clicking the submit button, I just want a pop-up box that says “Successful!” instead being sent to another page.
Please help me with WHERE to put the PHP code.
Thanks a lot in advance! :)# May 22, 2013 at 10:04 am
there are several tutorials form making functional contact forms
[custom-php-contact-forms](http://www.1stwebdesigner.com/tutorials/custom-php-contact-forms/) & [send-email](http://css-tricks.com/snippets/php/send-email/) & [video tutorial](http://www.youtube.com/watch?v=fLbtyu-QfUo) hopefully you will get what you need from 1 of these.# May 22, 2013 at 5:42 pm
… always check if the form was submitted before trying to process it
… always validate user-submitted data (make sure it *is* what you *expected*)
… don’t use `die()` for error handling
… don’t use the visitor’s email address in the `From` header
… also, as noted in the tutorial’s comments, this form in vulnerable to [header injection](http://wikipedia.org/wiki/Email_injection)
… many of the same issues (no header injection, though!)
… doesn’t check if sending email was successful or not; says “thanks” either way
I was helping someone (don’t remember who) with this example a few months back.
[Here’s what we came up with](https://gist.github.com/customanything/4385576).
… just the form (doesn’t actually send mail)
You must be logged in to reply to this topic.