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 Adding a Contact Form Working with Get Variables

Working with Get Variables Video

So I'm type out the code EXACTLY how it is posted in the video, but somehow I get a

"Notice: Undefined index: status in C:\xampp\htdocs\contact.php on line 26"

error in my web browser... It's at approx 1:55 minutes into the video...

<?php if ($_GET['status'] == 'thanks') { ?> <p>Thanks for the Email! We'll be in touch shortly!</p> <?php } ?>

The $_GET line is my line 26... What am I missing?!?

2 Answers

Matthew Underhill
Matthew Underhill
20,361 Points

Hi Travis,

Try changing your single quotes to double quotes. Also, is your thanks message nested inside of paragraph tags?

Sure is! And I tried double quotes... It's actually working now. I was missing the isset since the variable $_GET is undefined:

(isset($_GET["status"]) AND $_GET["status"] == "thanks")

Alberto Centelles
Alberto Centelles
8,356 Points

I have the same problem, but the solution you offer does not work for me. The problem seems to be that the variable status is not defined. Did I miss any part of the video where he defines it, or what can be the problem? Thanks!