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

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

Reply via email to