Jump to content

how to pass unchked checkbox ?


fatima_mj

Recommended Posts

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 by fatima_mj
Link to comment
Share on other sites

Just check the value in db_operation.php. It looks like you have the skills. If not, let us know.

Edited by niche
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...