Page 1 of 1

concatenating variable names? possible?

Posted: Tue Dec 31, 2002 9:50 pm
by vapulus
Okay, this should be a very simple thing, but I can't figure it out. It's been frustrating me for hours.

One one page, I've got an HTML form that has names generated with php using concatenation (sp?).
example: let's say the product number is 00A, the name of that field is set to 00Atype1. There will also be a 00Atype2 and 00Atype3.
So, in other words, for every product, there's a type1 field, a type2 field, and a type3 field.
These variables get passed to the next page.
I need to be able to access these variables again, but the problem is this.

00A is in variable $number...and there's a HUGE list of product numbers that go through this variable...so it's not something where I could just ask for each variable by it's name. I'm drawing it's number from a database...i just need to concatenate the number with "type1" to get the right response.

but i can't do this: echo($number.type1) or echo($number + type1) to get it to spit out the content of 00Atype1.

How do I do this? Hopefully this all made sense...it's kinda' hard to explain. I would be EXCEEDINGLY appreciative of anybody who could help. =P

Posted: Tue Dec 31, 2002 10:36 pm
by Gen-ik
Have you checked out the Eval() function? You'll find it in the PHP manual on this site.

Posted: Tue Dec 31, 2002 11:05 pm
by vapulus
Hmm...I'm failing to see how that would help, but I AM checking into it. There MAY be a way.

Posted: Wed Jan 01, 2003 1:01 am
by hob_goblin

Posted: Wed Jan 01, 2003 1:24 am
by vapulus
I am right now in the process of sending you my first born. =D