Re: pup
| From: | Phpster | Date: | Fri, 17 Apr 2009 12:08:46 +0000 |
| Subject: | Re: pup | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291613@lists.php.net to get a copy of this message | ||
On Apr 17, 2009, at 1:06, <ramesh.marimuthu@wipro.com> wrote:
Thanks Jim. Is there a way to get the value of that unchecked box? -rummy -----Original Message----- From: Jim Lucas [mailto:lists@cmsws.com] Sent: Friday, April 17, 2009 10:35 AM To: Ramesh Marimuthu (WT01 - Telecom Equipment) Cc: geek.de@gmail.com; php-general@lists.php.net Subject: Re: [PHP] pup ramesh.marimuthu@wipro.com wrote: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 ; BastienHi, I'm new to php. Say I have a check box which is checked already. Now I need to uncheckit and when I press the submit button, I should get the uncheckedvalue.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 inthe code in red font. regards, -rummyWhen 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