RE: [PHP] Checkbox Initial Value based on record in db

From: Date: Wed, 01 May 2002 20:11:17 +0000
Subject: RE: [PHP] Checkbox Initial Value based on record in db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-95585@lists.php.net to get a copy of this message
> Kinda off topic here, just checking to see If I am on the right track with > this > > <input type="checkbox" name="abb" value="<?php echo > $myrow['abb'] ?>"> > > the result should be : > > IF the record contains the field "abb" and it has a value of 1 > then it will > be checked off for viewing. No, that wouldn't work....to have a checkbox autochecked the HTML must be similar to <input type="checkbox" name="abb" value="<?php echo $myrow['abb']; ?>" checked> So a sample coding might be <input type="checkbox" name="abb" value="<?php echo $myrow['abb']; ?>" <?php if ($myrow['abb']) { echo 'checked'; } ?>> Sincerely, Craig Vincent

« previous php.general (#95585) next »