⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

For loop in dropdown - grocery crud



mstojanov
  • profile picture
  • Member

Posted 08 January 2014 - 17:16 PM

Hello, i'm new to Grocery Crud. 

 

What i need here is to make a dropdown list counting like this :

 

<?php for($i=5000; $i<=500000; $i=$i+5000) {?>

<option value="<?php echo $i; ?>"><?php echo $i; ?> passed</option>
<?php } ?>
 
 
How should i pass this for $i variable to :
 

$crud->field_type('for_loop','dropdown',

            array());

 

Thanks,
Any help will be appreciate.

 


mstojanov
  • profile picture
  • Member

Posted 09 January 2014 - 01:17 AM

Anyone ?


jinbatsu
  • profile picture
  • Member

Posted 09 January 2014 - 14:47 PM

<?php
for($i=5000; $i<=500000; $i=$i+5000) {
	$list_arr[$i] = $i . ' passed';
}
$crud->field_type('for_loop','dropdown', $list_arr);
?>

mstojanov
  • profile picture
  • Member

Posted 09 January 2014 - 23:43 PM

<?php
for($i=5000; $i<=500000; $i=$i+5000) {
	$list_arr[$i] = $i . ' passed';
}
$crud->field_type('for_loop','dropdown', $list_arr);
?>

This works very fine.

 

Thanks