Many Thanks Jim. Your idea worked.

-rummy

-----Original Message-----
From: Jim Lucas [mailto:li...@cmsws.com]
Sent: Friday, April 17, 2009 11:13 AM
To: Ramesh Marimuthu (WT01 - Telecom Equipment); PHP General List;
geek...@gmail.com
Subject: Re: [PHP] pup

ramesh.marimu...@wipro.com wrote:
> I'm developing a slot reservation page. It shows checked boxes for the

> currently logged user. If he likes to unreserve it, he should uncheck
> it. For other users it is disabled. Also a currently logged user can
> book another slot.
>
> Also when I use hidden types, only if all the checked boxes are
> unchecked, I could get the hidden values.
>
> -rummy
>

You could use an array system in your checkbox form section.?

Basically, take your check boxes.  I am assuming that you have a defined
list of what is expected?  Correct?

Have your elements setup like such:



<input type="checkbox" name="reserve[rm1]" value="yes" /> Room #1 <input
type="checkbox" name="reserve[rm2]" value="yes" /> Room #2 <input
type="checkbox" name="reserve[rm3]" value="yes" /> Room #3 <input
type="checkbox" name="reserve[rm4]" value="yes" /> Room #4 <input
type="checkbox" name="reserve[rm5]" value="yes" /> Room #5


Then on your processing page, you know that you have 5 rooms, 1 - 5.

With this information you can check to make sure that something exists

<?php

$rooms = range(1,5);

for ( $i = 1; $i <= 5; $i++ ) {
        if ( isset( $_POST['reserve']['rm'.$i] ) {
                # Room was checked
        } else {
                # Room was NOT checked.
        }
}

?>

Something like that should do the trick.

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

Reply via email to