Results 1 to 8 of 8

Thread: Variable Problem

  1. #1
    Join Date
    Mar 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Variable Problem

    basicly

    $_GET["Event"]

    will be numeric

    however it is going to be used like so : 'event'.$_GET["Event"].'text'

    e.g event4text

    and there will be a variable for that and i would like to echo the variable for event4text (wich will be a short description) as opposed to echoing event4text

    i do not no how to go about this at all ?

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I don't really get what you want. You didn't give any info, the code, or what you want. Please tell me.
    Thanks,
    Nile ^^
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    right i shal try to explain better

    in the URL $_GET["Event"] will be numerical (a number) and when i get the number from the url it shal be used in the following way: 'event'.$_GET["Event"].'text' (event4text) and for that i shal have $event4text = "short description" how would i echo the "short description" as opposed to echoing the "event4text"

    the 4 is only a example and could be any number got from the Event URL

    ps, i did have it all figured out useing SESSIONS but ie6 would not remember the session and would foget when the page changed. that is my reason for url based.
    Last edited by Locky; 04-22-2008 at 10:20 PM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP has a method for this, but it doesn't allow multi-part dynamic variables.

    So here's the code:
    PHP Code:
    $test 5//setup a variable
    $a 'te';
    $b 'st';
    $temporary $a.$b//$temporary = 'test';
    echo $$temporary//echo $test;
    //returns 5 
    So:
    $x = 'event'.$_GET['Event'].'text'; echo $$x;

    I'm not aware of any shortcuts. $(.....) might work, but I think that may do something else.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. The Following User Says Thank You to djr33 For This Useful Post:

    Locky (04-23-2008)

  6. #5
    Join Date
    Mar 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    This Is Exactly What I Wanted It Works A Treat Thankyou So Much It Is Appreciated!

  7. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yes Of Course No Problem Happy To Help (But Why Are You Capitalizing Like This? )
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #7
    Join Date
    Mar 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    i dno thought it wud show my message in caps

  9. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah, well no need to scream. The thanks is heard (and appreciated).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •