On Apr 17, 2009, at 1:06, <ramesh.marimu...@wipro.com> wrote:

Thanks Jim. Is there a way to get the value of that unchecked box?


-----Original Message-----
From: Jim Lucas [mailto:li...@cmsws.com]
Sent: Friday, April 17, 2009 10:35 AM
To: Ramesh Marimuthu (WT01 - Telecom Equipment)
Cc: geek...@gmail.com; php-general@lists.php.net
Subject: Re: [PHP] pup

ramesh.marimu...@wipro.com wrote:


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
Can anyone help me on this.


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."'

One.php calls 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.


When you uncheck a checkbox in an HTML form, it will not be submitted.


The part on the above page talking about "only "on" checkbox controls
can become successful." is the key here.

The successful part links here:


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.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

What I do in this case is define it to unchecked in the php code and then use the ternary operator to test it

$checkbox1 = 0;

$checkbox1 = (isset($_POST['check1'])) ? 1: 0 ;


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to