concatenating variable names? possible?
Posted: Tue Dec 31, 2002 9:50 pm
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
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