hi, your missing some brackets "[]"! this should work better: <td><input type="checkbox" name="val[]" value="a" /> AAA</td> <td><input type="checkbox" name="val[]" value="s" /> SSS</td>
regards, Bastian > 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.... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php