View Full Version : Variable Problem
Locky
04-22-2008, 10:02 PM
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 ?
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 ^^
Locky
04-22-2008, 10:12 PM
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.
djr33
04-22-2008, 11:50 PM
PHP has a method for this, but it doesn't allow multi-part dynamic variables.
So here's the 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.
Locky
04-23-2008, 12:13 AM
This Is Exactly What I Wanted It Works A Treat Thankyou So Much It Is Appreciated!
djr33
04-23-2008, 12:23 AM
Yes Of Course No Problem Happy To Help (But Why Are You Capitalizing Like This? :p)
Locky
04-23-2008, 12:26 AM
i dno thought it wud show my message in caps
djr33
04-23-2008, 12:59 AM
Ah, well no need to scream. The thanks is heard (and appreciated).
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.