Finding the name(s) of form data (esoteric?)
Posted: Tue Mar 29, 2005 6:59 pm
I have a question regarding a form i have created using a loop.
This form has text boxes that are generated with each pass through the loop. To differentiate the text box names, I have used this code:
The $stock_id is a different value each time through the loop and gives, as an example, output similar to this (assuming three times through the loop):
The question now, is when I post (or get
) that form data, how can I use a $_Get on the next page to retrieve the data, when the names could be different each time?
I can't use:
because depending on what the user has picked on the previous page, it could come through as something different and that code would then not work (I hope that made sense).
Does anyone have any ideas on how to actually find the name of the variables that are coming through (as well as their contents) so I can place them in variables?
I'm guessing, using pseudo code, it would look something like this:
Using that concept, variable 'stock_price11' with a value of '38' (for example) could then be called $stock_price11.
I think you get me.
Thanks for this, it's a real stumper and way beyond my current knowledge of form data handling.
This form has text boxes that are generated with each pass through the loop. To differentiate the text box names, I have used this code:
Code: Select all
<td class=\"clientview\"><div align=\"center\"><input name=\"stock_price".$stock_id."\" type=\"text\" value=\"$stock_price\" size=\"4\" maxlength=\"4\"></div></td>Code: Select all
stock_price11
stock_price2
stock_price43I can't use:
Code: Select all
$stock11 = $_GET['stock_price11'];
$stock43 = $_GET['stock_price43'];Does anyone have any ideas on how to actually find the name of the variables that are coming through (as well as their contents) so I can place them in variables?
I'm guessing, using pseudo code, it would look something like this:
Code: Select all
-look through post data
-find names (somehow :))
-use names to create a $_Get statement and assign variablesI think you get me.
Thanks for this, it's a real stumper and way beyond my current knowledge of form data handling.