1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Rep Power

    from above, how can I get the variable properly, it means I get the following:

    sorry for my poor English!

    Good Good Study
    Day Day Up
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Rep Power
    if it os something like this:

    then it's easy

    the variables look like:
    $mode = "add"
    $ord = "ok"
    $bla = "fine"

    after the " ? " the variables start, after eacht & a new one starts.
    This is also used by forms with the get method.

  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    I'm ignoring the ! in front of category. I don't know what !category=financial would be...

    Without the !, here is your solution
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    $var = "http://ln.doubleclick.net/adi/ly.ln/site_map;h=ent;pos=1;sz=468x60;tile=1;category=financial;ord=1007541?";
    $final_array = array();

    //Show original value
    echo "Original Variable = $var<BR>n";

    //strip off first part, including first
    //semi-colon and last question mark
    $string = substr(strstr($var,";"),1,-1);

    //Show seperated list
    echo "Seperated Variable List = $string<BR>n";

    //split by semi-colons
    $semi_part = explode(";",$string);

    $var = explode("=",$semi_part[$count]);
    $final_array[$var[0]] = $var[1];

    //extract variables

    echo "h = $h<BR>n";
    echo "pos = $pos<BR>n";
    echo "sz = $sz<BR>n";
    echo "tile = $tile<BR>n";
    echo "category = $category<BR>n";
    echo "ord = $ord<BR>n";

    Here is the output
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    Original Variable = http://ln.doubleclick.net/adi/ly.ln/...l;ord=1007541?
    Seperated Variable List = h=ent;pos=1;sz=468x60;tile=1;category=financial;ord=1007541
    h = ent
    pos = 1
    sz = 468x60
    tile = 1
    category = financial
    ord = 1007541

    Hope that helps. It should work for any amount of variables, too.

    ---John Holmes...
    The manual can probably answer 90% of your questions.

    PHP Manual: http://www.php.net/manual
    MySQL Manual: http://www.mysql.com/documentation/mysql/bychapter/

    [This message has been edited by SepodatiCreations (edited October 03, 2000).]

Similar Threads

  1. Store part of URL in session variable?
    By Jonny5uk in forum ASP Programming
    Replies: 4
    Last Post: February 13th, 2004, 07:34 AM
  2. Javascript variable added to 'src' url
    By polgateway in forum JavaScript Development
    Replies: 5
    Last Post: January 21st, 2004, 11:52 AM
  3. Replies: 11
    Last Post: January 20th, 2004, 11:26 PM
  4. Passing variable in a URL...
    By supergenius in forum PHP Development
    Replies: 4
    Last Post: January 7th, 2004, 01:42 PM
  5. encrypte/decrypte url variable..is this good method ?
    By phprock in forum PHP Development
    Replies: 0
    Last Post: December 6th, 2003, 05:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo