Posted by Dynamo on 05/18/06 17:27
Many thanks for your time David. I have however opted to use Kimmos code.
Nothing personal but he does mention that in html 4.01 that numbers should not
be used in variable names which I was doing.
Kind Regards
Dynamo
In article <uSZag.67292$_e3.16547@fe74.usenetserver.com>, David Haynes says...
>A trick when using checkboxes is to use a hidden field to record the
>'off' value, then have the checkbox.
>
>For example:
><?php
>foreach( $keys as $key ) {
>?>
><input type="hidden" name="<?php echo $key;?>" value="OFF">
><input type="checkbox" name="<?php echo $key;?>">
><?php
>}
>?>
>
>If the checkbox is checked the value will be 'ON'; if the checkbox is
>not set, the value will be whatever you set the hidden value to. ('OFF'
>in the example)
>
>To delete as per what you have shown:
>
>foreach( $_POST as $key => $value ) {
> if( $value == 'ON' ) {
> $del = "delete from catalogue where id = $key";
> mysql_query($del) or die("...");
> }
>}
>
>-david-
>
--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
[Back to original message]
|