John John - 1 year ago 52
PHP Question

Create different contents in one page

I have a php page named

. I want to make different contents in this page:

When the user (manually) navigates to
the script needs to show:
echo "one";

When the user (manually) navigates to
the script needs to show:
echo "two";

There are no POST or GET functions for this page. And I dont think it needs it. The user will enter the URL of the page and the script will show the content for the
that is entered by the user.

I found some examples on the internet, but in this scripts the script was getting the
(case) from the script and not from the URL.

My question is. How can I make these pages and specify the content for each of these pages?

Answer Source

Your question is pretty vague, but I'll answer it the best I know how.

Any url with ?[variable]=[value] has a get variable, and must be handled like so.

A pretty easy way to do what you're asking would be to do something like

$page = $_GET['id'];
  case '1':
    echo 'one';
  case '2':
    echo 'two';

but to get variables from the url, you have to use a get variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download