0

So. I've been trying to use switches from PHP. I've done this many many times. I end up cursing up entire world and threatening everybody in the world, I was sitting here for about an hour screaming the worst curses there possibly exist.

I don't know what happened. I don't this so many times, always the same way, it always worked like dream. And now at once when I try to imply to this a website, it stopped working. I turned into codework-thirsty screaming zombie, I got mad. I finished up thinking that maybe I did something wrong, so I opened new file typed code below:

<a href="?test=1">Test1</a> | <a href="?test=2">Test2</a>

<?php

    if (isset($GET["test"])) {
        $test = $GET["test"];

        if ($test == "1") {
            echo "The test is uno.";
        }
        elseif ($test == "2") {
            echo "The test is two.";
        }
        else {
            echo "Nothin'";
        }
    }

?>

and I have sincerely no tiniest idea. I always did it that way and it worked. Have I forgotten something? Because this code doesn't work as well.

Edited by RikTelner

2
Contributors
2
Replies
16
Views
3 Years
Discussion Span
Last Post by RikTelner
1

Shouldn't it be $_GET["test"]?

if (isset($_GET['test'])) {
    $test = $_GET['test'];

    ...
}

Edited by NoUserNameHere

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.