Results 1 to 8 of 8

Thread: i forgot what to do

  1. #1

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    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

  2. #2
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    its called register_globals i think.

  3. #3
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    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']
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    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?

  6. #6
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    maybe this:

    PHP Code:
    if(isset($_REQUEST['id'])){
        
    $id $_REQUEST['id'];
    } else {
        
    $id 1;

    and lets await the onslought of corrections

  7. #7

    Thread Starter
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909
    well it works, so thanks

  8. #8
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    not a problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width