Re: building a string question

From: Date: Tue, 03 Feb 2004 16:01:28 +0000
Subject: Re: building a string question
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-22720@lists.php.net to get a copy of this message
You either have to use double quotes to get $i parsed like this: $amendmentNumber = $_POST["amendmentID_$i"]; or you can use single quotes but you have to use $i as variable and not as part of a string like this: $amendmentNumber = $_POST['amendmentID_'.$i]; Cheers, /Donatas Herhuth, Ron wrote:
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


« previous php.windows (#22720) next »