Posted by Gordon Burditt on 08/20/07 00:05
>How do I have my whole site on one page of PHP and to get to the pages
>would be something like
>
>domain.com/index.php?page1
>domain.com/index.php?page2
You can get hold of the part of the query after the ? with:
$_SERVER['QUERY_STRING']
but that also includes GET or POST variables, if any, which you'd need
to remove. It might be easier to make your URL of the form:
domain.com/index.php?p=page1
and retrieve it with $_REQUEST['p'] .
After you get the value into a variable, you can use something like:
switch($_REQUEST['p']) {
case 'page1': /* code for page 1 goes here */
break;
case 'page2': /* code for page2 goes here */
break;
default: /* code for unexpected page goes here */
break;
}
Navigation:
[Reply to this message]
|