in reply to Re^2: mysql, checkbox, set, processing
in thread mysql, checkbox, set, processing

It's not really a Perl question, it's more of an organizational one. Bottomline, if you can be sick with all three, then use checkboxes. If only one, then use radio.

In your database you would have a table for all the kinds of sickness, a table for the patient id, and a table with a column for the patient id and one for the type of sickness id. You would join the patient and tables to do a query on any one patient.

HTML: <input type="checkbox" name="stomach" value="1" /> <input type="checkbox" name="head" value="2" /> <input type="checkbox" name="feet" value="3" /> SICKNESS TABLE: +----+---------+ | id | name | +----+---------+ | 1 | stomach | +----+---------+ | 2 | head | +----+---------+ | 3 | feet | +----+---------+ PATIENT TABLE: +----+---------+ | id | name | +----+---------+ | 1 | Bill | +----+---------+ | 2 | Susan | +----+---------+ | 3 | Mary | +----+---------+ STATUS TABLE: +------------+----------+ | patient id | sickness | +------------+----------+ | 1 | 2 | +------------+----------+ | 1 | 3 | +------------+----------+ | 2 | 1 | +------------+----------+

Insert a row into the "patient-sickness" table for each type of sickness the patient has checked.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re^4: mysql, checkbox, set, processing
by Anonymous Monk on Sep 02, 2005 at 14:55 UTC
    Well, honestly it WAS a perl question. I appreciate your kind response, but if you read mine, you'd see that I DIDN'T know that PERL would post the mulitple values for the same param name. That was the quick fix for my demo on Tuesday.

    I also mentioned that lookup tables are in the works for platform development (in fact every input type + textareas will have a table, with a series of lookup tables to connect pages, surveys and users), but are overkill for this particular form.

    Thanks again.