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 Basic PHP Website (2018) Adding a Basic Form SMTP with Google

Marko Vojvodic
Marko Vojvodic
32,207 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>'; }