473,545 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Dynamic URLs

Hello all,

I feel dumb having to ask this question in the first place, but I just
can not figure it out. I am wanting to set my site up using dynamic
urls (I'm assuming that's what they're called, an example of what I
have in mind is index.php?page=[pagename]). However, I can not figure
out how to do this. I will eventually want to use SEF urls, but for now
I'll be content just to have the dynamic urls. If anyone can tell me
how to do this, I'd really appreciate it. Thanks!

Oct 7 '06 #1
10 4893
"jflash" <ki****@gmail.c omwrote in message
news:11******** **************@ c28g2000cwb.goo glegroups.com.. .
Hello all,

I feel dumb having to ask this question in the first place, but I just
can not figure it out. I am wanting to set my site up using dynamic
urls (I'm assuming that's what they're called, an example of what I
have in mind is index.php?page=[pagename]). However, I can not figure
out how to do this. I will eventually want to use SEF urls, but for now
I'll be content just to have the dynamic urls. If anyone can tell me
how to do this, I'd really appreciate it. Thanks!
$page = $_REQUEST['page'];
if ($page == 'pageone') include './lib/pageone.php';

the url ( index.php?page=[pagename] )does not need the square brackets
note that the parameter names - in this case 'page' is case sensitive
HTH

Ron
Oct 7 '06 #2
jflash:
I am wanting to set my site up using dynamic urls
Why?

At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).
'Dynamic URL' is a misleading though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.

Couple of points on your example:

1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?

2. URL suffixes, unless you see the URL as pointing to a particular
representation of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.
I think another poster has suggested one way.
I will eventually want to use SEF urls,
I can guess what you mean by that, but again I think the term is
misleading.

--
Jock

Oct 7 '06 #3
Ron: I assume that I simply add that code to my 'initial' page
(index.php in the example I started with). However, I am curious how I
define a default page to load (i.e. in my index.php example, how would
I specify what page to include/what content to display in the event
that no parameters are entered)? Also, do I have to manually add each
page for the parameter to include in the file, or is there some way
that I can use a database for the list of parameters and their
corresponding pages?

Jock:

1. I had originally thought I could use dynamic URLs to pull content
from a database and display it on a page based on the parameters
defined in the URL. In any case, I hope that using the dynamic URLs
will make it easier for my users, particularly once I get search-engine
friendly URLs set up.

2. Actually, I already have a version of my site up, I mainly am doing
this because I am dooing a major overhaul for various other reasons,
and since I have been wanting to implement this for a while now, it
seems like a good time to do it.

3.1. I don't get what you're saying. I wasn't planning on using
index.php as the base file name, I just used it for an example.
Actually, now that you say it, I'm thinking I might use the 'index.php'
part of the URL to serve as a category, then define the specific page
later. I don't know, I'll decide that later.
3.2. I'm just using PHP because I know for a fact my server supports
it, and I see no reason to try anythign else and risk a lack of support
on the server end of things.

Thanks for the help!

On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:
jflash:
I am wanting to set my site up using dynamic urlsWhy?

At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).'Dynamic URL' is a misleading though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.

Couple of points on your example:

1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?

2. URL suffixes, unless you see the URL as pointing to a particular
representation of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.I think another poster has suggested one way.
I will eventually want to use SEF urls,I can guess what you mean by that, but again I think the term is
misleading.

--
Jock
Oct 7 '06 #4
I forgot to mention one thing: how can I use this setup to call
information from a database. For example, I've seen this done where the
search query from a search on a site is entered into the URL and is
then searched for in the database. HOw, then, is this done if all of
the 'redirects' (for lack of a better word) have to be predefined?

On Oct 7, 5:10 pm, "jflash" <ki4...@gmail.c omwrote:
Ron: I assume that I simply add that code to my 'initial' page
(index.php in the example I started with). However, I am curious how I
define a default page to load (i.e. in my index.php example, how would
I specify what page to include/what content to display in the event
that no parameters are entered)? Also, do I have to manually add each
page for the parameter to include in the file, or is there some way
that I can use a database for the list of parameters and their
corresponding pages?

Jock:

1. I had originally thought I could use dynamic URLs to pull content
from a database and display it on a page based on the parameters
defined in the URL. In any case, I hope that using the dynamic URLs
will make it easier for my users, particularly once I get search-engine
friendly URLs set up.

2. Actually, I already have a version of my site up, I mainly am doing
this because I am dooing a major overhaul for various other reasons,
and since I have been wanting to implement this for a while now, it
seems like a good time to do it.

3.1. I don't get what you're saying. I wasn't planning on using
index.php as the base file name, I just used it for an example.
Actually, now that you say it, I'm thinking I might use the 'index.php'
part of the URL to serve as a category, then define the specific page
later. I don't know, I'll decide that later.
3.2. I'm just using PHP because I know for a fact my server supports
it, and I see no reason to try anythign else and risk a lack of support
on the server end of things.

Thanks for the help!

On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:
jflash:
I am wanting to set my site up using dynamic urlsWhy?
At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).'Dynamic URL' is a misleading though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.
Couple of points on your example:
1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?
2. URL suffixes, unless you see the URL as pointing to a particular
representation of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.I think another poster has suggested one way.
I will eventually want to use SEF urls,I can guess what you mean by that, but again I think the term is
misleading.
--
Jock
Oct 7 '06 #5
jflash wrote:
>>
On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:
>>jflash:
I am wanting to set my site up using dynamic urlsWhy?
At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).'Dynamic URL' is a misleading though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.
Couple of points on your example:
1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?
2. URL suffixes, unless you see the URL as pointing to a particular
representatio n of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.I think another poster has suggested one way.
I will eventually want to use SEF urls,I can guess what you mean by that, but again I think the term is
misleading.
--
Jock
I forgot to mention one thing: how can I use this setup to call
information from a database. For example, I've seen this done where the
search query from a search on a site is entered into the URL and is
then searched for in the database. HOw, then, is this done if all of
the 'redirects' (for lack of a better word) have to be predefined?

On Oct 7, 5:10 pm, "jflash" <ki4...@gmail.c omwrote:
>Ron: I assume that I simply add that code to my 'initial' page
(index.php in the example I started with). However, I am curious how I
define a default page to load (i.e. in my index.php example, how would
I specify what page to include/what content to display in the event
that no parameters are entered)? Also, do I have to manually add each
page for the parameter to include in the file, or is there some way
that I can use a database for the list of parameters and their
correspondin g pages?

Jock:

1. I had originally thought I could use dynamic URLs to pull content
from a database and display it on a page based on the parameters
defined in the URL. In any case, I hope that using the dynamic URLs
will make it easier for my users, particularly once I get search-engine
friendly URLs set up.

2. Actually, I already have a version of my site up, I mainly am doing
this because I am dooing a major overhaul for various other reasons,
and since I have been wanting to implement this for a while now, it
seems like a good time to do it.

3.1. I don't get what you're saying. I wasn't planning on using
index.php as the base file name, I just used it for an example.
Actually, now that you say it, I'm thinking I might use the 'index.php'
part of the URL to serve as a category, then define the specific page
later. I don't know, I'll decide that later.
3.2. I'm just using PHP because I know for a fact my server supports
it, and I see no reason to try anythign else and risk a lack of support
on the server end of things.

Thanks for the help!
[Top posting fixed]

I don't fully understand what you are asking, but it seems to me that
you have an imperfect understanding of how CGI works.

A CGI script (such as a PHP program on a website) is a program that
generates as output the HTML that the web server will send to the browser.

Usually, the script takes arguments from the URL (usually the part after
the '?') to decide what to display, and very often it will obtain some
of the data on the page from a database.

Often, the script is capable of producing utterly different pages
depending on the input: for example, many CGI scripts display
information relating to a particular key in the database (a particular
site, person, company, date or whatever) and if called without the key
will display a different page that asks the user to specify the key.
Then the 'Submit' from that will go to the *same* script, but this time
with the data it needs.

If the URL has no CGI arguments, the program must cope with that case
and do something appropriate, for example request the information
intneeds as in the previous paragraph.

If you want not just to generate distinct pages, but to go to different
existing pages, you can do it by generating a HTTP header that redirects
to the appropriate page.

Does this help, or have I misunderstood your issue?

Colin
Oct 8 '06 #6
"Colin Fine" <ne**@kindness. demon.co.ukwrot e in message
news:eg******** ***********@new s.demon.co.uk.. .
jflash wrote:
>>>
On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:

jflash:
I am wanting to set my site up using dynamic urlsWhy?
At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).'Dynamic URL' is a
misleadin g though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.
Couple of points on your example:
1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?
2. URL suffixes, unless you see the URL as pointing to a particular
representati on of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.I think another poster
has suggested one way.
I will eventually want to use SEF urls,I can guess what you mean by
that, but again I think the term is
misleading .
--
Jock
I forgot to mention one thing: how can I use this setup to call
information from a database. For example, I've seen this done where the
search query from a search on a site is entered into the URL and is
then searched for in the database. HOw, then, is this done if all of
the 'redirects' (for lack of a better word) have to be predefined?

On Oct 7, 5:10 pm, "jflash" <ki4...@gmail.c omwrote:
Ron: I assume that I simply add that code to my 'initial' page
(index.php in the example I started with). However, I am curious how I
define a default page to load (i.e. in my index.php example, how would
I specify what page to include/what content to display in the event
that no parameters are entered)? Also, do I have to manually add each
page for the parameter to include in the file, or is there some way
that I can use a database for the list of parameters and their
corresponding pages?

Jock:

1. I had originally thought I could use dynamic URLs to pull content
from a database and display it on a page based on the parameters
defined in the URL. In any case, I hope that using the dynamic URLs
will make it easier for my users, particularly once I get search-engine
friendly URLs set up.

2. Actually, I already have a version of my site up, I mainly am doing
this because I am dooing a major overhaul for various other reasons,
and since I have been wanting to implement this for a while now, it
seems like a good time to do it.

3.1. I don't get what you're saying. I wasn't planning on using
index.php as the base file name, I just used it for an example.
Actually, now that you say it, I'm thinking I might use the 'index.php'
part of the URL to serve as a category, then define the specific page
later. I don't know, I'll decide that later.
3.2. I'm just using PHP because I know for a fact my server supports
it, and I see no reason to try anythign else and risk a lack of support
on the server end of things.

Thanks for the help!

[Top posting fixed]

I don't fully understand what you are asking, but it seems to me that you
have an imperfect understanding of how CGI works.

A CGI script (such as a PHP program on a website) is a program that
generates as output the HTML that the web server will send to the browser.

Usually, the script takes arguments from the URL (usually the part after
the '?') to decide what to display, and very often it will obtain some of
the data on the page from a database.

Often, the script is capable of producing utterly different pages
depending on the input: for example, many CGI scripts display information
relating to a particular key in the database (a particular site, person,
company, date or whatever) and if called without the key will display a
different page that asks the user to specify the key. Then the 'Submit'
from that will go to the *same* script, but this time with the data it
needs.

If the URL has no CGI arguments, the program must cope with that case and
do something appropriate, for example request the information intneeds as
in the previous paragraph.

If you want not just to generate distinct pages, but to go to different
existing pages, you can do it by generating a HTTP header that redirects
to the appropriate page.

Does this help, or have I misunderstood your issue?

Colin
Hi Jock,

The explanation Colin has given is absolutely correct but I suspect you are
still floundering ?

referring back the code example I gave

$page = $_REQUEST['page'];
if ($page == 'pageone') include './lib/pageone.php';

This needs to be inserted as you guessed in index.php
calling index.php with a parameter 'page' i.e. //index.php?page= something
will cause the $_REQUEST array to contain an element 'page' with a value
'something'
having extracted the key / value pair from the array it as in the example
you can do whatever you like with the 'something' - you can simply haul in
another static page, or call a routine that uses 'something' as the key to
extract data from a database.
the absence of a parameter is simply the default call for the page
index.php, so I would assume that it was a screen with some data entry that
would then be used in a subsequent call. - All this is simple HTML / HTTP
and not really PHP at all.

Cheers

Ron
Oct 8 '06 #7
OK, I am now fairly thoroughly confused. What I am asking is for a way
to have a page which can display information from a database filtered
and/or sorted based on arguments supplied by the user in the URL. I
wish I could explain it better, but that's the best way I know how.
Anything else that I need to know, I suppose I can figure out later.
Right now, I'm just trying to get the sorting/filtering down.

On Oct 8, 11:19 am, "Ron Barnett" <ron.REM...@RJB arnett.co.uk.RE MOVE>
wrote:
"Colin Fine" <n...@kindness. demon.co.ukwrot e in messagenews:eg* *************** ***@news.demon. co.uk...
jflash wrote:
>On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:
>>jflash:
I am wanting to set my site up using dynamic urlsWhy?
At least you are thinking about URL design before publishing your
pages: that puts you ahead of the masses. Retrospective URL design
is, in a word, iffy.
(I'm assuming that's what they're called, an example of what
I have in mind is index.php?page=[pagename]).'Dynamic URL' is a
misleading though common term for URLs with query
parts. Misleading because there is nothing dynamic about URLs. That
example, we can say, is a relative reference consisting of a path and a
query part (square brackets aren't allowed in query parts). Nothing
more. What the server does with that URL is up to you, but the URL,
the string of characters, is not dynamic.
Couple of points on your example:
1. "Indexes" rarely are indexes. Are you sure there isn't a better
name? No name, even?
2. URL suffixes, unless you see the URL as pointing to a particular
representatio n of the resource, serve no purpose. It is generally of
no consequence to users whether you use PHP or some other language to
create your pages.
However, I can not figure out how to do this.I think another poster
has suggested one way.
I will eventually want to use SEF urls,I can guess what you mean by
that, but again I think the term is
misleading.
--
Jock
I forgot to mention one thing: how can I use this setup to call
information from a database. For example, I've seen this done where the
search query from a search on a site is entered into the URL and is
then searched for in the database. HOw, then, is this done if all of
the 'redirects' (for lack of a better word) have to be predefined?
On Oct 7, 5:10 pm, "jflash" <ki4...@gmail.c omwrote:
>Ron: I assume that I simply add that code to my 'initial' page
>(index.php in the example I started with). However, I am curious how I
>define a default page to load (i.e. in my index.php example, how would
>I specify what page to include/what content to display in the event
>that no parameters are entered)? Also, do I have to manually add each
>page for the parameter to include in the file, or is there some way
>that I can use a database for the list of parameters and their
>correspondin g pages?
>Jock:
>1. I had originally thought I could use dynamic URLs to pull content
>from a database and display it on a page based on the parameters
>defined in the URL. In any case, I hope that using the dynamic URLs
>will make it easier for my users, particularly once I get search-engine
>friendly URLs set up.
>2. Actually, I already have a version of my site up, I mainly am doing
>this because I am dooing a major overhaul for various other reasons,
>and since I have been wanting to implement this for a while now, it
>seems like a good time to do it.
>3.1. I don't get what you're saying. I wasn't planning on using
>index.php as the base file name, I just used it for an example.
>Actually, now that you say it, I'm thinking I might use the 'index.php'
>part of the URL to serve as a category, then define the specific page
>later. I don't know, I'll decide that later.
>3.2. I'm just using PHP because I know for a fact my server supports
>it, and I see no reason to try anythign else and risk a lack of support
>on the server end of things.
>Thanks for the help!
[Top posting fixed]
I don't fully understand what you are asking, but it seems to me that you
have an imperfect understanding of how CGI works.
A CGI script (such as a PHP program on a website) is a program that
generates as output the HTML that the web server will send to the browser.
Usually, the script takes arguments from the URL (usually the part after
the '?') to decide what to display, and very often it will obtain some of
the data on the page from a database.
Often, the script is capable of producing utterly different pages
depending on the input: for example, many CGI scripts display information
relating to a particular key in the database (a particular site, person,
company, date or whatever) and if called without the key will display a
different page that asks the user to specify the key. Then the 'Submit'
from that will go to the *same* script, but this time with the data it
needs.
If the URL has no CGI arguments, the program must cope with that case and
do something appropriate, for example request the information intneeds as
in the previous paragraph.
If you want not just to generate distinct pages, but to go to different
existing pages, you can do it by generating a HTTP header that redirects
to the appropriate page.
Does this help, or have I misunderstood your issue?
ColinHi Jock,

The explanation Colin has given is absolutely correct but I suspect you are
still floundering ?

referring back the code example I gave

$page = $_REQUEST['page'];
if ($page == 'pageone') include './lib/pageone.php';

This needs to be inserted as you guessed in index.php
calling index.php with a parameter 'page' i.e. //index.php?page= something
will cause the $_REQUEST array to contain an element 'page' with a value
'something'
having extracted the key / value pair from the array it as in the example
you can do whatever you like with the 'something' - you can simply haul in
another static page, or call a routine that uses 'something' as the key to
extract data from a database.
the absence of a parameter is simply the default call for the page
index.php, so I would assume that it was a screen with some data entry that
would then be used in a subsequent call. - All this is simple HTML / HTTP
and not really PHP at all.

Cheers

Ron
Oct 8 '06 #8
jflash top-posted:
OK, I am now fairly thoroughly confused. What I am asking is for a way
to have a page which can display information from a database filtered
and/or sorted based on arguments supplied by the user in the URL. I
wish I could explain it better, but that's the best way I know how.
Anything else that I need to know, I suppose I can figure out later.
Right now, I'm just trying to get the sorting/filtering down.
Can you make a page that displays "Hello, <USER>!" when <USERcomes
from the query string?

Suppose I go to http://www.yourserver.com/hello.php?user=Pedro
The "hello.php" script would be something like

<?php
if ((isset($_GET['user'])) && ($_GET['user'] != '')) {
echo "Hello, {$_GET['user']}!";
} else {
echo "Hello, anonymous!";
}
?>

It's just about the same thing when you want to use data from the query
string for database selection/sort. You just need to get the data and
incorporate it in the SQL commands (*after validating the data*).

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 8 '06 #9
jflash wrote:
OK, I am now fairly thoroughly confused. What I am asking is for a way
to have a page which can display information from a database filtered
and/or sorted based on arguments supplied by the user in the URL. I
wish I could explain it better, but that's the best way I know how.
Anything else that I need to know, I suppose I can figure out later.
Right now, I'm just trying to get the sorting/filtering down.

On Oct 8, 11:19 am, "Ron Barnett" <ron.REM...@RJB arnett.co.uk.RE MOVE>
wrote:
>"Colin Fine" <n...@kindness. demon.co.ukwrot e in messagenews:eg* *************** ***@news.demon. co.uk...
>>jflash wrote:
On Oct 7, 11:11 am, usenet+2...@joh n.dunlop.name wrote:
>jflash:
>>I am wanting to set my site up using dynamic urlsWhy?
>At least you are thinking about URL design before publishing your
>pages: that puts you ahead of the masses. Retrospective URL design
>is, in a word, iffy.
>>(I'm assuming that's what they're called, an example of what
>>I have in mind is index.php?page=[pagename]).'Dynamic URL' is a
>>misleadin g though common term for URLs with query
>parts. Misleading because there is nothing dynamic about URLs. That
>example, we can say, is a relative reference consisting of a path and a
>query part (square brackets aren't allowed in query parts). Nothing
>more. What the server does with that URL is up to you, but the URL,
>the string of characters, is not dynamic.
>Couple of points on your example:
>1. "Indexes" rarely are indexes. Are you sure there isn't a better
>name? No name, even?
>2. URL suffixes, unless you see the URL as pointing to a particular
>representa tion of the resource, serve no purpose. It is generally of
>no consequence to users whether you use PHP or some other language to
>create your pages.
>>However , I can not figure out how to do this.I think another poster
>>has suggested one way.
>>I will eventually want to use SEF urls,I can guess what you mean by
>>that, but again I think the term is
>misleading .
>--
>Jock
I forgot to mention one thing: how can I use this setup to call
informatio n from a database. For example, I've seen this done where the
search query from a search on a site is entered into the URL and is
then searched for in the database. HOw, then, is this done if all of
the 'redirects' (for lack of a better word) have to be predefined?
On Oct 7, 5:10 pm, "jflash" <ki4...@gmail.c omwrote:
Ron: I assume that I simply add that code to my 'initial' page
(index.ph p in the example I started with). However, I am curious how I
define a default page to load (i.e. in my index.php example, how would
I specify what page to include/what content to display in the event
that no parameters are entered)? Also, do I have to manually add each
page for the parameter to include in the file, or is there some way
that I can use a database for the list of parameters and their
correspondi ng pages?
Jock:
1. I had originally thought I could use dynamic URLs to pull content
from a database and display it on a page based on the parameters
defined in the URL. In any case, I hope that using the dynamic URLs
will make it easier for my users, particularly once I get search-engine
friendly URLs set up.
2. Actually, I already have a version of my site up, I mainly am doing
this because I am dooing a major overhaul for various other reasons,
and since I have been wanting to implement this for a while now, it
seems like a good time to do it.
3.1. I don't get what you're saying. I wasn't planning on using
index.php as the base file name, I just used it for an example.
Actually, now that you say it, I'm thinking I might use the 'index.php'
part of the URL to serve as a category, then define the specific page
later. I don't know, I'll decide that later.
3.2. I'm just using PHP because I know for a fact my server supports
it, and I see no reason to try anythign else and risk a lack of support
on the server end of things.
Thanks for the help!
[Top posting fixed]
I don't fully understand what you are asking, but it seems to me that you
have an imperfect understanding of how CGI works.
A CGI script (such as a PHP program on a website) is a program that
generates as output the HTML that the web server will send to the browser.
Usually, the script takes arguments from the URL (usually the part after
the '?') to decide what to display, and very often it will obtain some of
the data on the page from a database.
Often, the script is capable of producing utterly different pages
depending on the input: for example, many CGI scripts display information
relating to a particular key in the database (a particular site, person,
company, date or whatever) and if called without the key will display a
different page that asks the user to specify the key. Then the 'Submit'
from that will go to the *same* script, but this time with the data it
needs.
If the URL has no CGI arguments, the program must cope with that case and
do something appropriate, for example request the information intneeds as
in the previous paragraph.
If you want not just to generate distinct pages, but to go to different
existing pages, you can do it by generating a HTTP header that redirects
to the appropriate page.
Does this help, or have I misunderstood your issue?
ColinHi Jock,
The explanation Colin has given is absolutely correct but I suspect you are
still floundering ?

referring back the code example I gave

$page = $_REQUEST['page'];
if ($page == 'pageone') include './lib/pageone.php';

This needs to be inserted as you guessed in index.php
calling index.php with a parameter 'page' i.e. //index.php?page= something
will cause the $_REQUEST array to contain an element 'page' with a value
'something'
having extracted the key / value pair from the array it as in the example
you can do whatever you like with the 'something' - you can simply haul in
another static page, or call a routine that uses 'something' as the key to
extract data from a database.
the absence of a parameter is simply the default call for the page
index.php, so I would assume that it was a screen with some data entry that
would then be used in a subsequent call. - All this is simple HTML / HTTP
and not really PHP at all.

Cheers

Ron
To do the sorting and filtering, you need to generate SQL queries based
on the arguments, and pass them to your database system.

Look at the examples in http://www.php.net/manual/en/ref.mysql.php.

Your query will be this sort of thing:

$query = "SELECT field1, field2, field3 FROM table WHERE ".
"match1 = '{$_GET['data1']}' AND ".
"match2 = '{$_GET['data2']}'";

from
index.php?data1 =xxx&data2=yyy

Colin
Oct 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2460
by: Seun Osewa | last post by:
Hi, I'm thinking of an architecture for a medium-complexity dynamic site as follows: - I use one php file, say a.php as the entry point for the entire site. PATH_INFO allows me to pass information to my script by using URLs like http://mysite.com/a.php/user1000 or http://mysite.com/a.php/images/10.gif and perform the appropriate action...
2
9700
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the URL of whatever page the user is visiting. I wanted to create a Win32 application using VB.NET. If there is a better way of doing this please let...
0
1473
by: only_me | last post by:
Not a coding question as such but highly related to asp/dynamic pages issues : has anyone any suggestions on the following ASP sites are generally (always) of a dynamic nature, pages can be built on the contents of querystrings, so search engines can only be directed to your first index.asp page since the search engine is unable to deduce...
1
1432
by: Benny | last post by:
Hi All, Good Morning! I just need to create 36 pages dynamically, each us a webpage for each person. Its dynamic from the Db, and the no seems to be growing. I am hoping to have short URLs like www.domainname.com/personname , Instead of giving lengthy form Posts (www.domainname.com/pages.asp?id=32)
2
4552
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is easy, but 1) How do I set about dynamically creating user controls (like TextBox, TextArea) --- simply Declare and initialised (new) the user...
3
6613
by: JL | last post by:
I have a VB.NET desktop program that reads/writes data to a server using a Java-based Web Service. This web service, in identical formats, is located on several servers with each server being a different customer and different data content. To connect with the Java Web Service, I downloaded the WSDL file and used wsdl.exe to create a .vb...
0
1801
by: eric.olstad | last post by:
I want to create a web site that can dynamically creates tabs -- like firefox functionality built into a web site. Take a look at this site to get an idea of what I'm looking to do: http://www.krugle.com/demos/Overview5_800.html Now, I'm not looking to copy the entire interface from Krugle, but I am very interested to understand how they...
4
2212
by: Nicole | last post by:
Hello, Can anyone tell me or give me an online tool which can help me to convert php dynamic urls to html urls to make a google friendly site.I dont have apache server on my computer and I dont want to use it.Wihtout apache server is it possible? And I amusing windows server and not Linux. Thanks Sunita Bihani
9
3612
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.