hi, Im rookie in php checkbox trying to understand how this works.
I create five squares boxes and each box has value number 1 to five
using this code
and then i created five check box and each each box has same number assign to the square box numberCode:<div class="sidebar1"> <ul class="nav"> <li><a href="#">Link one</a></li> <li><a href="#">Link two</a></li> <li><a href="#">Link three</a></li> <li><a href="#">Link four</a></li> </ul>
and then if check box is checked set value to one, if not check then set value to zero and update into the database...Code:<form action="" method="get"><input name="one" type="checkbox" value="1" /> one<br /> <input name="two" type="checkbox" id ="box_two" value="1" /> two<br /> <input name="three" type="checkbox" id ="box_three" value="1" /> three<br /> <input name="four" type="checkbox" id ="box_four" value="1" /> three<br /> <input name="five" type="checkbox" id ="box_five" value="1" /> three<br /> </form>
here what i wrote..
So how can i write the code if any field in database set value 1 in database then display the box, if any field in database set value 0 and not to display box using css or jquery.Code:<?php $box_one = "1"; $box_two = "1"; $box_three = "1"; $box_four = "1"; $box_five = "1"; if($box_box1 == 1) { $set_checked = " 1";} else{$set_checked = "0"; } if($box_two == 1) { $set_checked = " 1";} else{$set_checked = "0"; } if($box_three == 1) { $set_checked = " 1";} else{$set_checked = "0"; } if($box_four == 1) { $set_checked = " 1";} else{$set_checked = "0"; } if($box_five == 1) { $set_checked = " 1";} else{$set_checked = "0"; } ?>
how can i write that code!
AM


Reply With Quote

Bookmarks