fatima_mj Posted October 7, 2012 Share Posted October 7, 2012 (edited) hi alli hav an array of checkbox some of them are checked by default so the one is checked allows thedevice to be in the home page ,,,and when i uncheck any checked one the device won`t be in the home pageso it is so necessary to pass the value of un checked ones,,any help would be appreciated <?php include("header.php"); include("config.php"); $get_labdata=mysql_query("SELECT `lab_id`,`lab_name`,`home`,`lab_tel`,`lab_street` FROM `labs` WHERE `lab_case`=1") or die(mysql_error());?> <form method="post" action="db_operation.php"> <input type="hidden" name="req_type" value="agree_lab_home"> <table border="1" cellpadding="2" cellspacing="2" > <tr> <td colspan="2" align="center">choose what to display in home page</td> </tr> <?php while($labdata=mysql_fetch_array($get_labdata)) { if($labdata[home]==1) {?> <tr> <td align="center"><?=$labdata[lab_name]?></td> <td align="center"><input type="checkbox" name="agr_home[]" checked="check" value="<?=$labdata[lab_id]?>" /> <input type="hidden" name="agr_home[]" value="<?=$labdata[lab_id]?>" /></td> </tr><?php } else {?> <tr> <td align="center"><?=$labdata[lab_name]?></td> <td align="center"><input type="checkbox" name="agr_home[]" value="<?=$labdata[lab_id]?>" /> <input type="hidden" name="agr_home[]" value="<?=$labdata[lab_id]?>" /></td> </tr> <?php } }?> <tr> <td colspan="2" align="center"><input type="reset" value="reset"><input type="submit" value="homepage"></td> </tr> </table> </form> <?php include("footer.php"); ?> Edited October 7, 2012 by fatima_mj Link to comment Share on other sites More sharing options...
niche Posted October 7, 2012 Share Posted October 7, 2012 (edited) Just check the value in db_operation.php. It looks like you have the skills. If not, let us know. Edited October 7, 2012 by niche Link to comment Share on other sites More sharing options...
Ingolme Posted October 7, 2012 Share Posted October 7, 2012 Browsers don't send checkbox data if the checkbox is not checked. You will need to find another way to obtain the data. One way is to have it already on the server. Hidden inputs is another way. Link to comment Share on other sites More sharing options...
niche Posted October 7, 2012 Share Posted October 7, 2012 Yes, but you can always check if the key has been set. Link to comment Share on other sites More sharing options...
Ingolme Posted October 7, 2012 Share Posted October 7, 2012 Yes, that's supposing it has a unique key, you can use isset(). Link to comment Share on other sites More sharing options...
fatima_mj Posted October 7, 2012 Author Share Posted October 7, 2012 problem solved ^-^ ,,,thank u all so much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now