RE: pup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Many Thanks Jim. Your idea worked. 

-rummy

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

ramesh.marimuthu@xxxxxxxxx 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux