besly98 Posted October 11, 2010 Share Posted October 11, 2010 hi all. I have the following code that i want to put in a loop. The problem is that i want the $_REQUEST['scorer'] to go up by one each time (ad din the counter number) so it would read $_REQUEST['scorer1' ] then the next loop $_REQUEST['scorer2'] and so on. how can i do this? $counter = 1; while ( $counter <= $_GET['goals'] ) {echo $_REQUEST['scorer']."--<br />"; $counter = $counter + 1; } Quote Link to comment Share on other sites More sharing options...
Pawn Posted October 11, 2010 Share Posted October 11, 2010 $i = 0; $fp = TRUE; while($i <= $_GET['goals']) { if($fp) { $fp = FALSE; echo $_REQUEST['scorer']."--<br />"; } else { $i++; if(isset($_REQUEST['scorer'.$i])) { echo $_REQUEST['scorer'.$i]."--<br />"; } } } Quote Link to comment Share on other sites More sharing options...
besly98 Posted October 11, 2010 Author Share Posted October 11, 2010 fantastic. thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.