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

PHP Build a Simple PHP Application Wrapping Up The Project Sending The Contact Form Email

I'm pretty sure I've broken the internet. Why is this so slow?

What's happening: I've followed the instructions to the letter, even tried copying and pasting the necessary sections of the final project into my work and some how it's completely crashing the site!

The site I'm working on currently has two very simple pages 1) Home page with two paragraphs of text and an image, and 2) Contact page containing a form identical to the tutorial (although, not in a table). In other words, not at all heavy.

I start from a clean slate - deleting all files from the sever before re-uploading. First time i go onto the site - it's a dream. Very quick to load etc.. As soon as i submit a contact form, all hell breaks loose!

1) I never reach the header ( 'contact?status=thanks' ) page. ALTHOUGH, I do receive an email as expected, and the destination does change in the address bar. It's always loading but never loads. 2) The site starts a never-ending download e.g. (firefox) loading wheel never stops turning on either of the pages. 3) Site becomes slow or totally unresponsive on multiple devices. 4) Closing browser completely and re-entering the page doesn't help - doesn't load or has never-ending download. 5) Another site I have on with the same company (123-reg) also becomes very slow at the exact time this website breaks. Have I broken the internet? Maybe this is just a coincidence.

Any help would be much appreciated.

Would using SMTP avoid this problem? If so, would I include the smtp.phpmailer file instead of the class.phpmailer file? The tutorial on the blog post (http://blog.teamtreehouse.com/sending-email-with-phpmailer-and-smtp) doesn't show an inclusion of the file via the contact.php page, just that it sits on the server.

T

1 Answer

Andrew McCormick
Andrew McCormick
17,730 Points

shouldn't contact?status=thanks be contact*.php*?status=thanks . This may be the issue as the header is submitted before the HTML is rendered so it could run your code at the top of the page which looks for POST. Process your email, and then get stuck trying to figure out the header.
I would assume that the other page is stuck because you are looking at it on the same machine you were already on and your browser is getting weighted down figuring out the header.

be careful

Absolutely cracking. I would like to have said I went through the "cleaning up URLs" lessons and that's why I missed .php off... but that would be a lie.

Thanks!