我使用复选框将数据值存储在表中,其中值存储为1(可用服务)和0(不可用)。我如何更新复选框信息。 INSERTING
<?php
$chkbox = array('antenatal', 'arvtherapy','basicemergencyobstericcare',`'bloodtransfusion', 'caesereansection', 'curativeinpatient', 'curativeoutpatient', 'familyplanning', 'vct', 'homebasedcare', 'immunization', 'imofci', 'radiology', 'ruralhealthtraining', 'tuberculosis', 'cardiology','physiotherapy', 'spinalinjury', 'dental', 'optical');
if(isset($_POST['btnsave']))
{
if(isset($_GET['id']))
$id= $_GET['id'];
$serviceno = $_POST['serviceno'];
$values = array();
foreach($chkbox as $selection )
{ if(in_array($selection, $serviceno))
{ $values[ $selection ] = 1; }
else
{ $values[ $selection ] = 0; }
} // end of foreach.
$insert = "INSERT INTO hospitalservices (id,antenatal, arvtherapy, basicemergencyobstericcare, bloodtransfusion, caesereansection, curativeinpatient, curativeoutpatient, familyplanning, vct, homebasedcare, immunization, imofci, radiology, ruralhealthtraining, tuberculosis, cardiology, physiotherapy, spinalinjury, dental, optical)
VALUES ('$id',{$values['antenatal']}, {$values['arvtherapy']}, {$values['basicemergencyobstericcare']}, {$values['bloodtransfusion']}, {$values['caesereansection']}, {$values['curativeinpatient']}, {$values['curativeoutpatient']}, {$values['familyplanning']}, {$values['vct']}, {$values['homebasedcare']}, {$values['immunization']}, {$values['imofci']}, {$values['radiology']}, {$values['ruralhealthtraining']}, {$values['tuberculosis']}, {$values['cardiology']}, {$values['physiotherapy']}, {$values['spinalinjury']}, {$values['dental']}, {$values['optical']})";