Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
uworlds
1,784 PointsHow to e-mail info gathered on an HTML form?
Dear Fellow Treehousers,
Hello I was wondering how to use a <form> to gather a number of fields of information on a Web page, and then send all the fields (with field names) to an e-mail address (not to insert into a Web database, just e-mail at this stage).
I would also like to know how to send the data to the e-mail in a very aesthetic way, like using a pretty HTML table as opposed to a mumbo of unformatted text.
Any advice would be so enormously appreciated.
Best regards, Michael
2 Answers
Iban Dominguez
17,973 PointsHi Michael,
you need a server side language to do that, PHP is often the easiest to set up when it comes to web hostings.
You would basically need to build a form, containing all the required fields ( name, age, etc... ). This form ideally will post to a .php file where some validation would take place ( note you can also perform some validation on the front end as well as is hightly recommended to improve user experience ). If no errors were found then you can proceed to build up the template and send the email.
I will post some links here that might be useful.
Front end validation: jquery validate ( requires jquery ) there is a course where form js validation is cover on th, http://teamtreehouse.com/library/interactive-web-pages-with-javascript
HTML templates mailchimp blueprints ( there is a great course on the library ) http://teamtreehouse.com/library/html-email-design
Back end Mailing ( PHP ) PHPMailer ( this is covered on the library too ) http://teamtreehouse.com/library/build-a-simple-php-application
Basically if you follow the courses mentioned you ll get a solid understanding on how to build a proper web form / email template.
good luck!
uworlds
1,784 PointsThank you Iban!
I will do all of these courses. Looks like the perfect solution is wrapped up in there. You're way ahead of me so thanks for showing me that these courses exist.
Best regards, Michael
Iban Dominguez
17,973 PointsIban Dominguez
17,973 PointsNot a problem! glad to help ;)
this programming world moves so fast, no doubts tomorrow I might be asking and you might be solving!
cheers!