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

Cliff Jackson
Cliff Jackson
2,887 Points

Problem with PHP mailer file?

I have downloaded the zip file and put it in the vendor folder as on the video but my suggest page has now stopped working, not sure if this file is out of date which could be the cause of the problem?? Not sure if it could be an upper case vs lower case problem?

<?php //Import PHPMailer classes into the global namespace use PHPMailer\PHPMailer\PHPMailer; require 'vendor/phpmailer/src/PHPMailer.php'; require 'vendopr/phpmailer/src/Exception.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim(filter_input(INPUT_POST,"name",FILTER_SANITIZE_STRING)); $email = trim(filter_input(INPUT_POST,"email",FILTER_SANITIZE_EMAIL)); $details = trim(filter_input(INPUT_POST,"details",FILTER_SANITIZE_SPECIAL_CHARS));

if($name == "" OR $email == "" OR $details == "") { echo "Please fill in the required fields: Name, Email and Details"; exit; } if ($POST["address"] != "") { echo "Bad form input"; exit;

One thing I noticed right off is $SERVER should be $_SERVER

Also a closing bracket after your statement at the end.

2 Answers

Cliff Jackson
Cliff Jackson
2,887 Points

On my actual code the underscore is on $_SERVER for some reason when i copied and pasted it it does not show so i'm still stuck.

Cliff Jackson
Cliff Jackson
2,887 Points

Does not work at all, lack of support is becoming frustrating, it’s the one big thing that lets treehouse down