checkboxes

From: Date: Fri, 22 Nov 2002 11:16:14 +0000
Subject: checkboxes
Groups: php.general 
Request: Send a blank email to php-general+get-125589@lists.php.net to get a copy of this message
Hello; I want to do that: I have two checkboxes: if first one is checked assign the value as a; if first one is checked assign the value as s; if both of them checked assign th value as as and insert the result db; the html code: ... <tr> <td><input type="checkbox" name="val" value="a" /> AAA</td> </tr> <tr> <td><input type="checkbox" name="val" value="s" /> SSS</td> </tr> ... and the PHP code: $eval=''; if(isset($val)){ if(isset($val[0]) && isset($val[1])) $eval="as"; if(isset($val[0]) && !isset($val[1])) $eval="a"; if(!isset($val[0]) && isset($val[1])) $eval="s"; $sql="insert into maillist (ID, postmeth) values ('$id_no','$eval')"; $result=mysql_query($sql); if(!$result) echo("ERROR"); } I can't understand what is wrong; Thanks everybody....

« previous php.general (#125589) next »