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 trialChris Nelson
4,978 PointsMAMP > index.php viewing/functionality issues
After opening MAMP and going to Localhost to view index.php - showing the front page correctly, the following issues are occurring:
1) The tab shows <?php echo "Shirts 4 Mike"; ?> rather than just Shirts 4 Mike as it should.
2) Clicking on Contact or Shirts doesn't connect to those pages, but rather stays on the front page, and the address bar changes from "localhost" to "localhost/#"
What I tried: I downloaded the program files from the lesson "Creating Input Fields" and couldn't find any difference between the code in my php files and the code in the downloaded files - except for the contact.php file - which I made match at the end of the "Creating Input Fields" video.
I verified MAMP's preferences and verified that it pointed to the htdocs file within the MAMP folder where I have my index.php.
I verified that contact.php and shirts.php were in htdocs at the same level as index.php.
Can anyone help with this? I'm not able to verify my results with the video.
Thanks in advance.
3 Answers
Brett Doffing
4,978 PointsIs it possible that php has not been configured or installed? Try: <?php phpinfo(); ?> in index.php.
Try to run the file by going to www.yoursite.com/test.php. If you see your code, then you cannot run PHP. If you can run PHP you will see all the PHP information as it pertains to your hosting.
Brett Doffing
4,978 PointsWell, just navigate to your index.php as you were before. My link is just a placeholder for your URL.
Chris Nelson
4,978 PointsHmmmm. The issue seems to have fixed itself. I don't know if my removing the index.html from the htdocs folder in favor of the index.php file helped (The fix didn't reflect onscreen until much later so I'm not sure what fixed it. Anyway, thanks. If this issue creeps up again, I'll submit another discussion.
Thanks again. :)
Chris Nelson
4,978 PointsChris Nelson
4,978 PointsThat address www.yoursite.com/test.php takes me to a placeholder web page, not to where I can do this test. I don't have these files uploaded to a publicly accessible url. ??