Jump to content

Combining $_GET[] and a vaiable


b1011

Recommended Posts

Hey guys, im pretty new here, yet im pretty good at php. i decided to register for help with my only question:

 

How do you combine $_GET[]; with a variable.

 

pretend you have a URL: www.url.com/index.php?ID=5

and you had a variable on that page called "$topic"("hello").

 

how would you combine it into one string or variable that is "$topic" and $_GET['ID']?

 

combining the examples above out output a variable : "hello5" correct?

but is this even possible?

 

Link to comment
https://forums.phpfreaks.com/topic/47113-combining-_get-and-a-vaiable/
Share on other sites

Do you mean this:

$myvar = "abc';

$getvar = $_GET['ID'];

 

//if $getvar = "1"

//Then you want to declare a variable $abc1 ?

eval("\$" . $myvar . $getvar . ";");

 

visit: http://my2.php.net/manual/en/function.eval.php for eval() function details.

 

Hope this help you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.