Jump to content

Regarding PHP variable passing

  • Please log in to reply
2 replies to this topic

#1 Guest_kilbad_*

  • Guests

Posted 01 August 2006 - 06:13 PM

I am passing a variable in a URL called "image". This variable equals the numbers 1-7.

My problem is this, I need to take the variable's value (let's say the url is example.php?image=1 ), and use it to echo another variable, which will, in another file, specify the image's caption..

So with this example, I want to be able to take the "1" and combine it with the word "caption" to echo the variable "caption1" which will already be defined in another place.

Can anyone help me with this?

thanks in advance


P.S. also see my post at htmlforums for more details:: http://htmlforums.co...ead.php?t=80062

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 01 August 2006 - 06:16 PM

Do something like this:
$img = $_GET['image'];
echo ${'content'.$img};

#3 Guest_kilbad_*

  • Guests

Posted 01 August 2006 - 06:24 PM

brilliant!! thank you so much!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users