|
-
Sep 22nd, 2002, 06:09 PM
#1
Thread Starter
Fanatic Member
i forgot what to do
What do i need to change in the apache server config file to have it so it automatically takes variables from the URL?
like if i have a url like this:
www.site.com/index.php?id=1
how do i setup apache so that it sets the $id variable to one with that url? Someone offerred me hosting for a site of mine and there apache isnt parsing the id variable
-
Sep 22nd, 2002, 08:18 PM
#2
Hyperactive Member
its called register_globals i think.
-
Sep 23rd, 2002, 01:15 PM
#3
Frenzied Member
it isn't parsing it because register_globals is off. you need to use teh super globals to get the url variable and that global is $_GET[].
so in this example it would be
www.site.com/index.php?id=1
$ID = $_GET[id];
echo $ID; // ID =1
-
Sep 23rd, 2002, 07:35 PM
#4
Stuck in the 80s
Re: i forgot what to do
Originally posted by stickman373
What do i need to change in the apache server config file to have it so it automatically takes variables from the URL?
like if i have a url like this:
www.site.com/index.php?id=1
how do i setup apache so that it sets the $id variable to one with that url? Someone offerred me hosting for a site of mine and there apache isnt parsing the id variable
The register_globals is in the php.ini file. It has nothing to do with apache.
And I would go with phpman and recommend you use the superglobals, ie $_REQUEST['id'] or $_POST/$_GET['id']
-
Sep 23rd, 2002, 07:50 PM
#5
Thread Starter
Fanatic Member
how can i have it so if there is no id stated when using $_REQUEST['id'] that it doesn't give an error it just sets 1 as the id by default?
-
Sep 23rd, 2002, 08:05 PM
#6
Hyperactive Member
maybe this:
PHP Code:
if(isset($_REQUEST['id'])){
$id = $_REQUEST['id'];
} else {
$id = 1;
}
and lets await the onslought of corrections
-
Sep 23rd, 2002, 08:13 PM
#7
Thread Starter
Fanatic Member
well it works, so thanks
-
Sep 24th, 2002, 12:09 PM
#8
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|