Date dropdown from array |
[eluser]33cent[/eluser]
Hi, i'm currently working on some project, which has need for date dropdown box. I'd like to "feed" my form_dropdown with array generated by this function, but i haven't much experience with this, so i need your help. Code: function dates() This part of code returns: Code: Array ( [2009-11-26] => 26. 11. 2009. ) But i need complete array, from today to three days in the past. Please help. P.S. Variable $days must be easy changeable. Thanks!
[eluser]CroNiX[/eluser]
Try changing Code: $data = array ($1 => $d2); to Code: $data[] = array ($1 => $d2); and putting it inside your loop. The way you have it now you are only adding the final value from your loop which is why you are only getting one result.
[eluser]33cent[/eluser]
Excellent! Thanks! But, i got output like this: Code: <select name="date"> How can i remove that "optgroup" labels from array? Because, it looks like this: Quote:http://i47.tinypic.com/2dqt3yb.png
|
Welcome Guest, Not a member yet? Register Sign In |