The file extension you use doesn't really matter, unless there's PHP code in it, then it's nice to hide it in a PHP file.
That looks right for pulling the GET variables, and will default to down.html if it's not set.
The include() statement should work as is--if your .html files are in the same directory (conceptourneys.com). If they're in a separate directory, like /includes, you'd have to change it to this:
include("includes/{$_GET['page']}.html");
Or better yet:
include("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.html");
You could also just put the include in the if statement, like this:
<?php
if (isset($_GET['page'])) {
include("{$_SERVER['DOCUMENT_ROOT']}/{$_GET['page']}.html");
} else {
include("{$_SERVER['DOCUMENT_ROOT']}/down.html");
}
?>
Or, if you do have another directory in the path:
<?php
if (isset($_GET['page'])) {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.html");
} else {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/down.html");
}
?>
Even better yet, make sure the requested page exists in your directory, to keep people from trying to inject stuff:
<?php
if (isset($_GET['page']) && file_exists("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.html")) {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/{$_GET['page']}.html");
} else {
include("{$_SERVER['DOCUMENT_ROOT']}/includes/down.html");
}
?>
In reply to:
It works but if I just type conceptourneys.com/index.php it gives me an error. But if I type conceptourneys.com/index.php?page=down and it works. Did I do it rite?
It shouldn't give an error, because no variable should be the same as if it was set to ?page=down. I'd make sure that the files are either in the same directory as index.php, or add the folder they're in to the path.