Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Martin Batista
4,606 PointsGetting Notice: Undefined variable: name in /home/treehouse/workspace/index.php on line 23
I declared all my variables correctly: <?php> $name = "Mike"; $location = "Orlando FL"; $fullName = Mike The Frog; $name = $fullName; ?>
3 Answers

Jason Anders
Treehouse Moderator 145,704 PointsHey Martin,
Thank you for posting the snapshot. It looks like you have a minor typo/syntax error at the top of the file when you declare the variable $fullName
(on line 4 in index.php) ... "Mike The Frog" needs to have quotation marks around it. Just add the quotation marks to surround the string and you should no longer have that error.

Jason Anders
Treehouse Moderator 145,704 PointsAnd I just noticed, I don't think you need line 5. $name
is supposed to hold the first name and $fullName
holds, well, the full name. Line 5 is assigning the full name to the $name
variable, overwriting the original declaration. Just double check that. :)

Florian Glembotzki
Courses Plus Student 4,370 PointsHere is a working solution. For better definition of your problem a snapshot would help, like Jason posted before.
<?php
$name = "Mike";
echo $name;
?>

Martin Batista
4,606 PointsHere is the snapshot of my code: https://w.trhou.se/lyjh9oq8f4
thank you in advance for the help. : )
Jason Anders
Treehouse Moderator 145,704 PointsJason Anders
Treehouse Moderator 145,704 PointsHey Martin,
You will need to post a snapshot of your Workspace so we can help you troubleshoot. There is a 'camera' like icon in the top left corner of your Workspace. This takes a snapshot and provides you with a link. This URL can be posted in a comment on this post, if you like. Sometimes, you do need to open the link yourself and copy the URL from the address bar.