RE: [PHP-DB] Checkboxes, PHP, and MySQL

From: Date: Thu, 20 Dec 2001 16:45:10 +0000
Subject: RE: [PHP-DB] Checkboxes, PHP, and MySQL
Groups: php.db 
Request: Send a blank email to php-db+get-15148@lists.php.net to get a copy of this message
the value doesn't determine whether it's checked or not - it determines the value passed WHEN it's checked. try the lines below: echo"<input type=/"checkbox/" name=/"firstvalue/" value=/"1/""; if ($result[32] == 1){ echo" checked>"; }else{ echo">"; } or something along these lines. -----Original Message----- From: SpyProductions Support Team [mailto:support@spyproductions.com] Sent: 20 December 2001 16:40 To: php-db@lists.php.net Subject: [PHP-DB] Checkboxes, PHP, and MySQL I've looked around in a few of the PHP lists for an answer to this, but can't come up with one. Here's what I am doing: I have a form with a few checkboxes. When the information as to whether the checkboxes are checked or not is 'saved' into the MySQL table, they are represented by a value of '1' - fine. When I want to edit this information, in the form of a similar form with checkboxes, the boxes are not checked off if they were before. What I am stuck on is how a checkbox can get checked off when pulling information from the MySQL as an array. Here's a line of code showing my array coming out. <input type=checkbox name=firstvalue value='$result[32]'> $result is the array. I guess what I am asking is that if a checkbox is assigned a value of one, why doesn't it appear as already checked off? Thanks, -Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01

« previous php.db (#15148) next »