For loops adding

From: Date: Wed, 19 Jul 2000 14:54:00 +0000
Subject: For loops adding
Groups: php.general 
Request: Send a blank email to php-general+get-7276@lists.php.net to get a copy of this message
Hi I'm using a for loop to display the results of a form. Basically the user chooses how many times they want the form repeating, they then fill in the form then submit it. What I need to then be able to do is display the results back to them. So for example I have loop like this to display the fields. for ($i=0;$i<$choice;$i++) { echo "<input type=\"text\" name=\"text$i\"> } if $choice was 2 it would obviously give me 2 text boxes named0 and text1 When I come to process the field I am again using the for loop to display the results but I can't find a way to display the current value of $i from the loop so if I try to print echo $text.$i I get 0 etc. without it giving me the proper value How do I "add" these together so it would give me the current value of $text according to $i. Thanks M@

« previous php.general (#7276) next »