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.

PHP Build a Basic PHP Website (2018) Adding a Basic Form SMTP with Google

Marko Vojvodic
Marko Vojvodic
32,148 Points

i need a little help about this entire section(php built a basic website)

look at this code....

header("location:kontakt.php?status=hvala");

if(isset($_GET['status']) && $_GET['status'] == "hvala") {
            echo "<p class='message-info'>";
            echo "Well done!";
            echo "</p>";
        }

you see that I defined $_GET variable.So when i upload all to server I dont see message "Well done",and when I call from my localhost then I see.......Where I'm doing wrong.....Please Anyone...Thanks

1 Answer

Marko,

I'm wondering if your code hasn't made a sort of infinite loop. I'm assuming that the source code you've posted is for the file, kontakt.php. If so, when your code executes, it will hit your header redirect in Line 1 and continue redirecting over and over until the browser breaks the loop for you. Try something like the following:

if (!isset($_GET['status']) || $_GET['status'] != 'hvala') { header('Location: kontakt.php?status=hvala'); } else { echo '<p class="message-info">Well done!</p>'; }