Thanks Jim. Is there a way to get the value of that unchecked box? -rummy -----Original Message----- From: Jim Lucas [mailto:lists@xxxxxxxxx] Sent: Friday, April 17, 2009 10:35 AM To: Ramesh Marimuthu (WT01 - Telecom Equipment) Cc: geek.de@xxxxxxxxx; php-general@xxxxxxxxxxxxx Subject: Re: pup ramesh.marimuthu@xxxxxxxxx wrote: > > Hi, > > I'm new to php. > Say I have a check box which is checked already. Now I need to uncheck > it and when I press the submit button, I should get the unchecked value. > Can anyone help me on this. > > One.php > > if($qry[0]!=$login_type) > { > echo "<td class=tabhead align=center > style=background-color:#CC66CC><input type=checkbox name=disable > value=a".$count." checked DISABLED /></br>".$slot_value."</td>"; } > else { echo "<td class=tabhead align=center > style=background-color:#00CCCC><input type=checkbox name=enable[] > value='--user ".$slot_value." --ne ".$nen." --timespec ".$slt."' > checked >> </br>".$slot_value."</td>"; > } > > One.php calls Two.php > Two.php > > $enable_slot= $_POST['enable']; > $uncheck_slot= $_POST['uncheck']; > > if ($enable_slot){ > echo "$enable_slot"; > foreach($enable_slot as &$a) { > echo "<p>".$a." --unreserve</p>"; > } > } > > I get only the results only if checked. I think I'm doing a mistake in > the code in red font. > > regards, > -rummy > > When you uncheck a checkbox in an HTML form, it will not be submitted. http://www.w3.org/TR/html401/interact/forms.html#checkbox The part on the above page talking about "only "on" checkbox controls can become successful." is the key here. The successful part links here: http://www.w3.org/TR/html401/interact/forms.html#successful-controls This explains that the definition of a successful checkbox submission is one that is "on". To have a checkbox in the "on" state means that it has to be checked. So, any checkbox that is /not/ checked is considered "off" or "undefined" will not be submitted because it is not valid. Or something like that... :) Jim Lucas Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php