SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pulling a value from a string w/o variable?

    Excuse the summary line - I wasn't sure how to ask about this.

    I know how to get a value from a string, i.e. www.example.com?value=abc

    What I am wondering is if the string looks like this:

    www.example.com/abc

    1. Does that always mean that it will be searching for a directory named 'abc'?

    2. If not, how can I pull that 'abc' from the string when it's not defined by a variable?

    3. If it only wants a directory, how can I redirect from within that directory? My redirect URL needs to contain a stored variable from an include file. So, how can that happen redirect script must be the first code on the page?

    I'm referring to the redirect that begins with "header.." -- is there another way? That I'll keep researching, but if there's a quick yes/no that would help.

    Thanks! Hope this made sense, lol.

    Amber

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Doesn't make much sense to me.

    If your URL is http://www.example.com/?value=abc, and the index page for that site is a PHP script, then 'abc' will be in $_GET['value'].

    I don't know what you're asking with the /abc. Unless you've written rules with mod_rewrite or mod_redirect to change the URL scheme for your site, that would be the URL of the index page in the abc directory. You would need to examine the REQUEST_URI or PATH_INFO in $_SERVER if your script there somehow didn't know it was in /abc (code it in?) and you wanted to find that fact out.


Bookmarks

Posting Permissions

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