You are here: Re: Newbie Question « PHP Programming Language « IT news, forums, messages
Re: Newbie Question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация