faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input : Validating Data

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 14 people (36%) answered Yes
Recently 1 of 7 people (14%) answered Yes

Entry

How can I force users to choose at least one checkbox from a group?

Jan 25th, 2000 18:11
Nathan Wallace, Manuel Lemos


There is a PHP Form generation and validation class that among other
things does just that. Take a look here. There's an example that shows
exactly how to make the kind of validation you want:

    http://phpclasses.UpperDesign.com/browse.html/package/1

You might prefer to do the check in Javascript before the form is
submitted to the server.