Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: How do I use a database and handle checkboxes?by Ovid (Cardinal) |
on Aug 22, 2000 at 06:51 UTC ( [id://28960]=note: print w/replies, xml ) | Need Help?? |
There are many ways of addressing this issue. The following is not the best, but it works. I have a form where teachers can enter lesson plans and a series of check boxes represent the appropriate grade levels, K through 12. The checkboxes are named GradeK, Grade1, ... Grade12.
When this data is sent via CGI, the parameter is sent to the script as GradeK=on (or whatever value you set the checkbox at). No checkbox parameter is sent if it's not checked. Therefore, I use the following sub to pull the data: This sub is called from the following sub which uses DBI to write the data to a MySQL database: This should give you a good start on how to approach this (Grades is defined as varchar(28), by the way).
Cheers,
In Section
Seekers of Perl Wisdom
|
|