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

Still getting "Please fill in the required fields:"

When I enter an invalid name, email, etc., I'm still getting "Please fill in the required fields: Name, Email and Details" --- even when the PHPMailer is set up.

I set it up exactly as on screen:

// if (!PHPMailer::validateAddress($email) { //

...although the new version of PHPMailer has a syntax like this (adjusted for the !not condition):

// if (!PHPMailer::validateAddress($_POST['email']))) { //

Is this the issue?

Also, I'm getting "Please fill in the required fields: Name, Email and Details" when I AM writing things that are NOT empty strings. The setup is like this:

// if ($name == "" || $email == "" || $details == "") { echo "Please fill in the required fields: Name, Email and Details"; exit; } //

This executes even when I enter characters. What's going on?

1 Answer

Resolved. Turns out the filters for some of the fields were not in my original code. Thanks anyway.