Guest kilbad Posted August 1, 2006 Share Posted August 1, 2006 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 advanceBrendanP.S. also see my post at htmlforums for more details:: http://htmlforums.com/showthread.php?t=80062 Quote Link to comment https://forums.phpfreaks.com/topic/16230-regarding-php-variable-passing/ Share on other sites More sharing options...
wildteen88 Posted August 1, 2006 Share Posted August 1, 2006 Do something like this:[code=php:0]$img = $_GET['image'];echo ${'content'.$img};[/code] Quote Link to comment https://forums.phpfreaks.com/topic/16230-regarding-php-variable-passing/#findComment-67213 Share on other sites More sharing options...
Guest kilbad Posted August 1, 2006 Share Posted August 1, 2006 brilliant!! thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/16230-regarding-php-variable-passing/#findComment-67220 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.