Re: Another problem with grids and checkboxes
| From: | John Holmes | Date: | Sun, 01 Aug 2004 02:20:33 +0000 |
| Subject: | Re: Another problem with grids and checkboxes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192426@lists.php.net to get a copy of this message | ||
Henri Marc wrote:
<td style="vertical-align: top;">1<input name="grid[1][1]" value="1" type="checkbox"><br></td>[snip]
<td style="vertical-align: top;">1<input name="grid[2][1]" value="1" type="checkbox"><br>Is there a reason you're sending a 1, 2 or 3 value with the checkboxes? You already know what was checked by the keys of the $grid array. I'd leave it similar to how you have it, but just pass 1 for every value (since you won't be needing it). You can create your grid like this: <td style="vertical-align: top;">1<input name="grid[1][1]" value="1" type="checkbox"<?php if(isset($grid[1][1])){echo ' checked';}?>><br></td> <td style="vertical-align: top;">2<input name="grid[2][2]" value="1" type="checkbox"<?php if(isset($grid[2][2])){echo ' checked';}?>><br></td> etc... That'll "remember" what boxes were checked when the grid is redisplayed, also. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com</td>