Re: Validation Help

From: Date: Fri, 15 Dec 2000 16:53:09 +0000
Subject: Re: Validation Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30516@lists.php.net to get a copy of this message
RealGM Webmaster wrote: > > Hi, > > I have got a problem, and everything I have tried has not worked. > > I have four groups of variables that are passed from a checkbox on one page to the next. These > are configured in a way so the variables are passed with the following names. > > p101, p102, p103... etc > p201, p202, p203... etc > p301, p302, p303... etc > p401, p402, p403... etc > > Numbers one and two are compulsory, while numbers three and four are optional. Currently if no > options are selected from either number one or number two the user can still continue, but we do not > want them to be able to do this. We want them to select at least one checkbox from each group. > > Obviously if the user selects one for number two, but zero from number one the url will look > something like file.php?p201=xxxx. There will be no reference to p1xx in there, so there is no way > I know that I can do a if statement to check to see whether a value is assigned on the proceeding > screen. Does anyone know how I can force the user to select at least one from each of the active > options? This is the kind of thing where javascript really shines. As a service to your viewer, not to absolutely validate, but to speedily help verify they've punched the right buttons. Alas, I know not much js. But for php: Aren't we just talking about: if($p201 || $p101) { # a page with a message to do the right thing and a link back } Mike D.

« previous php.general (#30516) next »