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.

Recommended Answers

All 2 Replies

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

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

    ...
}

OH!!! Oh my! Thanks! I'm such an idiot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.