[FX.php List] Editing Checkboxes

Michael Layne fx at 9degrees.com
Wed Oct 25 16:11:10 MDT 2006


Kim,

This may look overkill, but cycling through values, this is how I always 
check or uncheck checkboxes to make edits:

// I look for whether the selection is in an array I posted to the 
database when inputting for the first time and if it is, I check that box:

$ans06 = array ('MSWord' => 'MS Word','MSPPT' => 'MS 
PowerPoint','MSExcel' => 'MS Excel');

say hey initially checked "MSWord" and "MSExcel", those would be the 
ones checked when editing...

in FM = field=answer06, value = MSWord, MSExcel
    $count6 = 1;
    foreach($ans06 as $value => $label) {
        $checked = ( eregi($value,$dJP['answer06'][0])) ? 
"checked=\"checked\"" : "";
        echo "<input name=\"answer06[]\" type=\"checkbox\" value=\"" . 
$value . "\" $checked />" . $label . "\n";
        if ($count6 == 6) {
            echo "<br />\n";
        }
        $count6++;
    }

HTH

Michael

Kim Hawksworth wrote:
> I can get checkboxes to work fine when I submit  a new record. 
> However, I can't seem to uncheck a box that's already been checked 
> when doing an edit.  I'm using the code from the latest edition of 
> FX.php in 8 Hour submit to submit and display selected values.  Is 
> there something else that needs to be done to edit checkboxes.
>
> --Kim
> -- 
> Kim David Hawksworth, R.Ph., Web Manager
> The OSUMC Dept. of Pharmacy
> 410 W. 10Th Ave, Room 368 Doan
> Ph# (614) 293-3765
> Pager# (614) 730-8143
> Email: kim.hawksworth at osumc.edu
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20061025/cc7b414d/attachment.html


More information about the FX.php_List mailing list