Umm.... fun with variables... I guess?
Posted: Fri Jun 21, 2002 2:16 pm
So here's my problem, I've got a bit of javascript, it goes ahead and writes a form, adds a bunch of hidden values to it, and then when I submit it passes it to PHP. Now, the problem is, in my PHP I don't exactly know how to deal with the variables... more precisely, I don't know how many are coming in, until they come in... and I'm sending a variable with that number, but I don't know how to write variables that are... well.. variable. If that made any sense I'm shocked... but anyway, exampel being this: I pass the form and it sends a variable $numberOf that tells me how MANY sets there are of the next variables. Then it passes $ID_1 as the first set and $ID_2 in the second set, and so on. Now really I would just like to make a for loop that takes $ID_ and concatonates the $numberOf to the end of the variable name... then I could pass all these into an array, and it'd be easier to deal with them... but I can't for the life of me figure out how to modify the variable name, and it doesn't seem to be a really common thing to do, as I haven't found a tutorial for it yet. Anyone have suggestions? Thanks.