Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing variablename??

Status
Not open for further replies.

Nightsoft

Programmer
Aug 23, 2001
50
DK
Hi.. This is my problem which i have been troubling around some time now.

A have a php page which gets a dynamic variable from another page in a link extension.
This is my link :

...href="somepage.php&query=dynamicvariable">

Then what i want to do is to take the dynamicvariable and put _tekst in the end of what ever the dynamicvariable is.

so if my link was:
...href="somepage.php&query=funstuff">

and my new page will make a variable called

funstuff_tekst

anyone got the point. !! I Tried something like

echo '$(($query)_tekst)'; and other versions of that one. i thought hmm php hmm linux :) there it would work.. I WANT BASH....

Well anyway.. Anyone know how to do it?

Thnx Machine code Rocks:)
 
Have you tried

${$query.'_tekst'}

______________________________________________________________________
TANSTAAFL!
 
Hi.

I tried what you wrote but it didn't seen to work. A puzzled a little and it stil don't work :-(
This is my line :

$content = $content.${$query.'_tekst'};

First it was :

$content = $content."$($query.'_tekst')";

I've tried with both paranthesis types and with extra around the $query ... still don't work..

My error is this :
Parse error: parse error, unexpected '=' in /home/ on line 9

That, I can't understand... Whats wrong with it being there.. I use it everywhere the $content variable is used in another script, which makes the formatting of the page.

I'll keep on puzzeling and hope to hear from some.
Thnx anyway sleipnir214 Machine code Rocks:)
 
See the following documentation on string parsing and interpolation:

-- Look for the "Complex (curly) syntax" string section.

-------------------------------------------

Big Brother: "War is Peace" -- Big Business: "Trust is Suspicion"
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top