Re[2]: [PHP] checkbox

From: Date: Sat, 25 Nov 2000 21:00:25 +0000
Subject: Re[2]: [PHP] checkbox
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27182@lists.php.net to get a copy of this message
Hello Folke, I understand that I need to wright a if statement I am not sure how to wright it or where to put it FA> you can check checkboxes with an "checked" FA> <input type="checkbox" name="terms" FA> value="<?php echo $row["frontpage"]?>" FA> <?php if (your_condition) print " checked"?> >> > > I know this should be simple to figure out but I am stuck. > I have three check boxes on a form all for different things. > When I check them or don't check them they add ether yes or no to > the database field corresponding to them. This is what I want them > to do. My problem is when I pull the data back in to a form for > update or viewing. I can not figure out how to make the check boxes be > checked if the value is yes. > > <?php > $query = "SELECT * FROM pcustomers WHERE id = $id"; > $result=mysql_db_query($dbName,$query); > $row = mysql_fetch_array($result); > mysql_free_result($result); > > ?> > > <input type="checkbox" name="frontpage" value="<?php echo > $row["frontpage"] ?>"> > <input type="checkbox" name="terms" value="<?php echo > $row["terms"] ?>"> > <input type="checkbox" name="wantdatabase" value="<?php echo > $row["wantdatabase"] ?>"> >

« previous php.general (#27182) next »