Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public function someplugin_select() {
  2. $options = get_option( 'plugin_252calc');
  3. echo $options; //shows the correct value selected
  4. $items = array();
  5. for ($i=6; $i <=10; $i+= 0.1)
  6. {
  7. $items[] = $i;
  8. }
  9.  
  10. echo '<select id="cf-nb" name="cf-nb">';
  11. foreach ( $items as $item )
  12. {
  13. echo '<option value="'. $item .'"';
  14. if ( $item == $options ) echo' selected="selected"';
  15. echo '>'. $item .'</option>';
  16. }
  17.  
  18. echo '</select>';
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement