复选框值将显示在同一页面中

I have a page with multiple rows and columns.

enter image description here

So, when a user is logged in, if he has any entry in the back end, it should be displayed in front end. Display, if value is 1 in backend table, and should be unchecked if 0 is in back end.

                        {$i=0}
                        {foreach from=$last7days item=date}
                        <tr>

                             <td><b>&nbsp;&nbsp;{$date}</b><input type='hidden' name='date[]' value ='{$date}'></td>
                             <td><input type='checkbox' name='BREAKFAST[]' value='1' ><input type='hidden' name='BREAKFAST[]' value='0'></td>
                              <td><input type='checkbox' name= 'LUNCH[]' value='1'><input type='hidden' name= 'LUNCH[]' value='0'></td>
                             <td><input type='checkbox' name= 'EVENING[]' value='1'><input type='hidden' name= 'EVENING[]' value='0'></td>
                             <td><input type='checkbox' name= 'DINNER[]' value='1'><input type='hidden' name= 'DINNER[]' value='0'></td>
                              <td><input type='checkbox' name= 'MIDNIGHT[]' value='1'><input type='hidden' name= 'MIDNIGHT[]' value='0'></td>
                        </tr>
                        {/foreach}

for the php :-

   $show_details =   mysql_query("select id,user,date,BREAKFAST,LUNCH,EVENING,DINNER,MIDNIGHT,timeUpdate from phpgroupware_new.foodPlan
                        user='$name'");

table:-

mysql> select * from foodPlan;
+----+------------+------------+-----------+-------+---------+--------+----------+---------------------+
| id | user       | date       | BREAKFAST | LUNCH | EVENING | DINNER | MIDNIGHT | timeUpdate          |
+----+------------+------------+-----------+-------+---------+--------+----------+---------------------+
|  1 | monisha.md | 2015-03-07 |         1 |     1 |       1 |      1 |        1 | 2015-03-07 11:43:45 |
|  2 | monisha.md | 2015-03-08 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  3 | monisha.md | 2015-03-09 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  4 | monisha.md | 2015-03-10 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  5 | monisha.md | 2015-03-11 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  6 | monisha.md | 2015-03-12 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  7 | monisha.md | 2015-03-13 |         0 |     0 |       0 |      0 |        0 | 2015-03-07 11:43:45 |
|  8 | admin      | 2015-03-07 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
|  9 | admin      | 2015-03-08 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
| 10 | admin      | 2015-03-09 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
| 11 | admin      | 2015-03-10 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
| 12 | admin      | 2015-03-11 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
| 13 | admin      | 2015-03-12 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
| 14 | admin      | 2015-03-13 |         1 |     1 |       0 |      0 |        0 | 2015-03-07 12:35:57 |
+----+------------+------------+-----------+-------+---------+--------+----------+---------------------+
14 rows in set (0.00 sec)

I think you should remove the other hidden input that defines a different value 0 and just include the first input with value 1. maybe this can help you start unless i misunderstood your question

if (isset($_POST['BREAKFAST'])
{
$breakfast = $_POST['BREAKFAST'];

foreach($breakfast as $item) 
if($item == 1) //that means box is checked
// what do you want to do
else
// what you want to do if box is not checked
}

you actually don't need to use an array for your input you will be fine with just a variable

try this,,

<input type="checkbox" <?php
echo($breakfast == 1)? 'checked="checked"' : ''?> name="BREAKFAST[]" value="<?php echo $breakfast; ?>" > 

$breakfast is the value from your db which comes from for loop.