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

HTML

Joel Rivera
Joel Rivera
29,401 Points

HTML / PHP Forms

I am looking to add a form to my website. The site is already coded in html.

  1. How can I add a form to my index.html page that will work with the contact.php page?
  2. How do I add a captcha code to prevent spam?
  3. What about email Injections, How do I prevent that?

Thank you for your help.

4 Answers

Joel Rivera
Joel Rivera
29,401 Points

Hey James,

I wanted to update this question. My first website I designed over 2 years ago and did it in html and css without the file extension of php. Issue is the site has grown and becomes tedious to maintain and update.

Since I've learned more php I would like to add its features like includes for easier site updates. Issue is I am on page 1 of google for my main keywords and fear changing file extensions would cause a drop in rankings.

What is the best way to resolve this?

Thanks for your help.

samiff
samiff
31,206 Points

As usual James, thanks for linking to some great resources!

And Joel, if you haven't already, try looking at Randy's Build a Simple PHP Application course. He goes over fully implementing a contact form in this series.

Mark Flavin
Mark Flavin
10,199 Points
  1. As suggested by Sam I would start with Randy's Course
  2. ReCaptcha is a great easy to plugin captcha system that works well.
  3. As to preventing SQL injection that is a bigger topic but using Prepared Statements is a good step in the right direction. Good Foundational Article
Joel Rivera
Joel Rivera
29,401 Points

Thanks everyone for your guidance