#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Ridgeland, MS USA
    Posts
    1
    Rep Power
    0
    Setup: I have a url that is called like www.company.com/main.php3?id=12 and I need to read the value of id inside the main.php3 file.

    Problem: I don't know if the person who typed the url in used upper, lower, or mised case when spelling 'ID'. And $ID, $id, $Id are all different variables.

    Question: How do I get a case-insensitive var name to use?? or how do I determine the case. Do I have to use GET_VARS and loop through each var passed looking for the one i want?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Well, there isn't such a thing as a case-insensitive variable name. You have absolutely no control over how it's accessed? Isn't it coming from a link?

    If you can't control it, you'll have to set up an if structure checking each possible way that they could have entered it. Major PITA.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Seattle Wa Us
    Posts
    12
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by kivey:
    Setup: I have a url that is called like www.company.com/main.php3?id=12 and I need to read the value of id inside the main.php3 file.

    Problem: I don't know if the person who typed the url in used upper, lower, or mised case when spelling 'ID'. And $ID, $id, $Id are all different variables.

    Question: How do I get a case-insensitive var name to use?? or how do I determine the case. Do I have to use GET_VARS and loop through each var passed looking for the one i want?
    [/quote]

    I don't know if this will work (I'm a newbie)
    but you could turn all the $HTTP_GET_VARS int o lower case. Include this in a file called:
    common.inc

    // declre the request array
    $arr_request = array();

    //move the parameters to the request array

    if (count($HTTP_GET_VARS)) {
    while (list($key, $value) = each ($HTTP_GET_VARS)) {
    $arr_request[strtolower($key)] = $value;
    }
    }

    You can do the same for post. It turns all the requests to lower case under the $arr_request['request name']

    If you have already written a large application, this may be a titious task.

    Again, I am a newbie so this might not work.
    Please e-mail and tell me how it goes.

    -Jerome
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Good one, Jer!

Similar Threads

  1. Flash MX / PHP global vars
    By stranger2all in forum Flash Help
    Replies: 0
    Last Post: August 26th, 2003, 02:11 PM
  2. HOW to get PHP session vars from PERL?
    By wzhaoca in forum PHP Development
    Replies: 4
    Last Post: August 13th, 2003, 06:40 PM
  3. Compiling Java code in DOS
    By pete5668 in forum Beginner Programming
    Replies: 11
    Last Post: June 9th, 2003, 07:00 AM
  4. Replies: 12
    Last Post: December 19th, 2001, 02:52 AM
  5. How to get JavaScript vars into PHP vars?
    By Henning in forum JavaScript Development
    Replies: 0
    Last Post: November 26th, 2001, 02:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo