Announcement

Collapse
No announcement yet.

Create Checkbox Items from PHP

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create Checkbox Items from PHP

    Hi
    i like to use a PHP function to generate checkboxes for everyday between a startdate and an enddate. These to date a lookup in a table.

    The PHP function works pretty well, can generate any strings, delimiters and so on with the Weekdays between the two dates.

    But how can i set up the checkboxes with this content. I need one checkbox for every day.

    Thank's for your help

    Best regards
    Steve

  • #2
    All I can think of is creating a query.
    So we create a table called dates with an nr column type number with values 0 through 31 (for example)
    Then you'd need to cross that table, so it'd become database depending now..

    In oracle:
    select to_date('01-01-2014','DD-MM-YYYY')+dates.nr from dates where to_date('01-01-2014','DD-MM-YYYY')+nr<to_date('22-01-2014','DD-MM-YYYY')

    Thus you get a row of dates.
    02-JAN-14
    03-JAN-14
    04-JAN-14
    05-JAN-14
    06-JAN-14
    07-JAN-14
    08-JAN-14
    09-JAN-14
    10-JAN-14
    11-JAN-14
    12-JAN-14
    13-JAN-14
    14-JAN-14
    15-JAN-14
    16-JAN-14
    17-JAN-14
    18-JAN-14
    19-JAN-14
    20-JAN-14
    21-JAN-14

    So now you all need to do is do something similar in your database (mysql??) and you are done.
    Something like this might help you:
    select adddate(curdate(),nr) from dates where nr<10 order by nr that gives you a list of tomorrow and some days after that...

    Comment

    Working...
    X