Alidad Posted February 8, 2013 Share Posted February 8, 2013 (edited) Hi, I'm rookie in php checkbox and I'm trying to understand how to write the code , i have five checkbox in one form like this <form action="" method="get"><input name="one" type="checkbox" value="one" /> one<br /> <input name="two" type="checkbox" value="two" /> two<br /> <input name="three" type="checkbox" value="three" /> three<br /> <input name="four" type="checkbox" value="four" /> three<br /> <input name="five" type="checkbox" value="five" /> three<br /> </form> if checkbox on then show the box, if checkbox is not check, then not show the box, so i understand that need to use zero or one in mysql database in one column called "display". My question is that how can i write the code in checkbox form whether if is zero or one, but how to write code to show DISPLAY OR NOT DISPLAY when reatrieve from mysql database EVEN USING CSS OR NOT. please help thanks. AM Edited February 8, 2013 by Alidad Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 8, 2013 Share Posted February 8, 2013 You need to post the code that you're having trouble with, and be a lot more specific about your question. You are confused about how to retrieve data? Or display it? Quote Link to comment Share on other sites More sharing options...
Alidad Posted February 8, 2013 Author Share Posted February 8, 2013 here is what i wrote in database connection include("connect.php"); $query = "SELECT id, display FROM dragdrop"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = stripslashes($row['id']); $display = stripslashes($row['display']); ?> <li id="arrayorder_<?php echo $id ?>"><?php echo $id?> <?php echo $text; ?> and in body there is five box and each box has number one number from 1 to five. <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> <div id="options"> and in checkbox form each checkbox assign to box number and if any box has checkone meaning to display, of not check on meaning not to display <form action="" method="get"><input name="one" type="checkbox" value="one" /> one<br /> <input name="two" type="checkbox" value="two" /> two<br /> <input name="three" type="checkbox" value="three" /> three<br /> <input name="four" type="checkbox" value="four" /> three<br /> <input name="five" type="checkbox" value="five" /> three<br /> </form> anyway, I use ajax meaning that every time checkone or not it will automatic update in database right away and refereshe it which is works great, but to display or not to display is i can't figure out ... doe any one can help me! AM Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.