MyBB Community Forums

Full Version: A PHP Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Can be done like this:
<?php
if($_GET[id] == "1") {
echo "you have clicked the link that says page1, congrads.";
} elseif($_GET[id] == "2") {
echo "you have chosen the link that says page2, cool!";
}
?>
I'm trying to get it to work with other things other then one...like page and chapter...not sure if it can be done.
$_GET['id'] is the correct variable. I'm not sure what you mean by page and chapter but if you mean you can have ?page=testpage you can just use $_GET['page'] instead and match it with for example if($_GET['page'] == 'testpage').
I figured out how to do it. Just change "id" in the code I posted to whatever you want. Big Grin
You can even have more than one:
page.php?id=something&page=somethingelse
Ooo, how?
Just make the link like that and you can check the id and the page like the same as you posted about. It will be in $_GET['id'] and $_GET['page'].
Pages: 1 2