Jump to content

PHP HELP


besly98

Recommended Posts

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

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.