RE: building a string question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ron,

What I do is this:

Firstly, $howmany is passed as a final loopcounter from the form.

for ($index = 1; $index < $howmany; $index++){
	$varname = 'varname'.$index;
	$varname = $_POST[$varname];
	//repeat process for $vars and do something
}


It works for me.

George in Oxford
> -----Original Message-----
> From: Herhuth, Ron [mailto:Ron.Herhuth@tatumpartners.com]
> Sent: 3 February 2004 3:58 pm
> To: php-windows@lists.php.net
> Subject:  building a string question
>
>
>
> I am pulling my hair out here...and I'm thinking someone might be able to
> help me.  My situation is that I have a series of dynamic form elements
> that are created on a previous page and now on the process page I am
> trying to cylce through them...but I can't seem to build the string I need
> to extract the values.  The part of the script that is causing me problems
> is:
>
> for($i=0;$i<$_POST['numberOfAmendments'];$i++)
> {
>
> $amendmentNumber = $_POST['amendmentID_$i'];
>
> }
>
> The $_POST['amendment_ID_
> was created in a loop so I am using a loop to try to get at it's
> value...but PHP isn't allowing me to use the $i in conjunction with the
> $_POST array to build the string to get at the value.
>
> Can anyone help me construct the string to get at the array value?
>
> Thanks in advance!
> Ron
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux