Jump to content

[SOLVED] Simple Array


Bricktop

Recommended Posts

Hi all,

 

I'm trying to create a drop-down box of 0 to 100 percent using an array.  The code I have is as follows:

 

function percentage()
{
$numbers = range (0, 100);
foreach($numbers as $number)
{
	$content .= '<option value="'.$number.'">'.$number.'%</option>';
}
echo $content;
}

 

I've never been too good with arrays so I've obviously made an error somewhere, could anyone tell me what I've done wrong please?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/170805-solved-simple-array/
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.