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


ERR_TOO_MANY_REDIRECTS message on Chrome...

In the middle of this video (about 4:45 in, when we go to check if forms will submit when blank), I go to suggest.php and I get an error message. It's ERR_TOO_MANY_REDIRECTS.

Here's my code: (Note: I was having trouble in an earlier video getting the thank you page to load, so the solution seemed to be moving the header function to the top. That's why it is there and not in the same place as the video. Don't think that's causing my issue, but I could most definitely be wrong!)

  $name = trim($_POST["name"]);
  $email = trim($_POST["email"]);
  $details = trim($_POST["details"]);

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

  echo "<pre>";
  $email_body = "";
  $email_body .= "Name " . $name . "\n";
  $email_body .= "Email " . $email . "\n";
  $email_body .= "Details " . $details . "\n";
  echo $email_body;
  echo "</pre>";
//To Do: Send email!

$pageTitle = "Suggest a Media Item";
$section = "suggest";

include("inc/header.php"); ?>

1 Answer

Simon Coates
Simon Coates
28,694 Points

your first statement is a redirect. This should probably be placed inside a condition. Redirect should occur if your operation is successful. Left outside a condition, it'll just loop redirects. hence the message.

Thank you! That was it. I'd accidentally moved the redirect outside of the condition.