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; } Link to comment https://forums.phpfreaks.com/topic/215613-php-help/ 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 />"; } } } Link to comment https://forums.phpfreaks.com/topic/215613-php-help/#findComment-1121035 Share on other sites More sharing options...
besly98 Posted October 11, 2010 Author Share Posted October 11, 2010 fantastic. thanks. Link to comment https://forums.phpfreaks.com/topic/215613-php-help/#findComment-1121037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.