Re: [PHP] Variable Nightmare
Okay I think this is what you want. If you want $myNewVarX too you should be able to figure it out. Check out php.net/manual/en/language.variables.variable.php for loop blah $myNewVar = ${'value'.$x}; Also, you may want to consider just naming every field "value[]", which results in $_POST['value'] (or $_GET['value']) being an array of your values. On Wednesday 08 October 2003 09:51 pm, richard cook wrote: > Hi all, > I have a problem that I cant solve, any help would be welcomed! > > > I have a form which is repeated by a for loop, the form has one element an > input field. The problem im having is the name of this field for example > ive used the following to name it: > > for loop here > > value="" /> > > } > > So the input name will increase with each loop like so: > > value1 > value2 > value3 > ... > > This works fine, the source code from the generated page looks as it > should. So the big question is how do I get to the variable name when the > form is processed, ive tried everything i know. if I use hard coding it > works : > > $myNewVar = $value1; > > But the whole point of this is that the values need to be pulled out of > another for loop: > > for loop blah > $myNewVar = $valueX; > } > > > > > I hope im explaining this well. > > > > Regards > > R -- Evan Nemerson [EMAIL PROTECTED] -- "A leader is the wave pushed ahead by the ship." -Leo Nikolaevich Tolstoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Nightmare
Yes. PHP supports this feature you need. for loop $i { $temp="value".$i; $myNewVar = $$temp; } Hope it help. Ryan Thompson <[EMAIL PROTECTED]> 10/09/2003 01:38 PM To: "richard cook" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] cc: Subject:Re: [PHP] Variable Nightmare The server probably has global variables turn off Try $_GET['value1'], $_GET['value2'] If you using post method then replace $_GET with $_POST On Thursday 09 October 2003 00:51, richard cook wrote: > Hi all, > I have a problem that I cant solve, any help would be welcomed! > > > I have a form which is repeated by a for loop, the form has one element an > input field. The problem im having is the name of this field for example > ive used the following to name it: > > for loop here > > value="" /> > > } > > So the input name will increase with each loop like so: > > value1 > value2 > value3 > ... > > This works fine, the source code from the generated page looks as it > should. So the big question is how do I get to the variable name when the > form is processed, ive tried everything i know. if I use hard coding it > works : > > $myNewVar = $value1; > > But the whole point of this is that the values need to be pulled out of > another for loop: > > for loop blah > $myNewVar = $valueX; > } > > > > > I hope im explaining this well. > > > > Regards > > R -- Ryan Thompson [EMAIL PROTECTED] http://osgw.sourceforge.net == "A computer scientist is someone who fixes things that aren't broken" --Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Nightmare
The server probably has global variables turn off Try $_GET['value1'], $_GET['value2'] If you using post method then replace $_GET with $_POST On Thursday 09 October 2003 00:51, richard cook wrote: > Hi all, > I have a problem that I cant solve, any help would be welcomed! > > > I have a form which is repeated by a for loop, the form has one element an > input field. The problem im having is the name of this field for example > ive used the following to name it: > > for loop here > > value="" /> > > } > > So the input name will increase with each loop like so: > > value1 > value2 > value3 > ... > > This works fine, the source code from the generated page looks as it > should. So the big question is how do I get to the variable name when the > form is processed, ive tried everything i know. if I use hard coding it > works : > > $myNewVar = $value1; > > But the whole point of this is that the values need to be pulled out of > another for loop: > > for loop blah > $myNewVar = $valueX; > } > > > > > I hope im explaining this well. > > > > Regards > > R -- Ryan Thompson [EMAIL PROTECTED] http://osgw.sourceforge.net == "A computer scientist is someone who fixes things that aren't broken" --Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable Nightmare
Hi all, I have a problem that I cant solve, any help would be welcomed! I have a form which is repeated by a for loop, the form has one element an input field. The problem im having is the name of this field for example ive used the following to name it: for loop here } So the input name will increase with each loop like so: value1 value2 value3 ... This works fine, the source code from the generated page looks as it should. So the big question is how do I get to the variable name when the form is processed, ive tried everything i know. if I use hard coding it works : $myNewVar = $value1; But the whole point of this is that the values need to be pulled out of another for loop: for loop blah $myNewVar = $valueX; } I hope im explaining this well. Regards R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php