Thursday, May 30, 2013

How to insert looping checked box value into db?

This is my code and attached the format i need please check it.

INDEX.CTP

<div>
<?php echo $this->Form->Create('Schedule'); 
    $appday = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
        $apptime = array('01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00');
     ?>
     <table>
      <tr><td></td>
        <?php  
        for($k=0; $k<23; $k++) {
            echo '<td>'.$apptime[$k].'</td>';
            }
            echo '</tr>'; 
        ?>
        </tr>
     <?php   
        for($i=0; $i<7; $i++) {
        echo '<tr><td>'.$appday[$i].'</td>';
            for($j=0; $j<23; $j++) {
     ?>
            <td>
            <?php
                echo $this->Form->checkbox($appday[$i].'.'.$apptime[$j],array('hiddenfield' =>false));
                ?>
            </td>
     <?php       }
            echo '</tr>';
        }
     ?>
     </table>
    <?php
    echo $this->Form->end('Submit');
    ?>
</div>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: