List:General Discussion« Previous MessageNext Message »
From:Martin Jespersen Date:July 26 2006 5:17pm
Subject:Re: Checkboxes
View as plain text  
Looks like more of a php question that a mysql question ;)

anyway, the mysql part:

use either an unsigned interger (tinyint, if less than 256 
possibilities, smallint if over 256 but less than 65565, etc)

or use a set or enum.

Using a varchar is not really the way to go.

If you choose to use an integer and you need some kind of string 
representation of the choice, use a secondary table to hold the string 
values and let the integer in the main table be a foreign key to the 
secondary table ;)




Nicholas Vettese wrote:
> I am trying to allow a user to use checkboxes for multiple selections, and I am
> trying to get the database to record the choices made by the user.  I am using a
> VARCHAR(250), but I am guessing that may be wrong.  Also, other than adding a "[]" to the
> end of the 'name' (e.g. <input type="checkbox" name="mod_type[]" value="alternative"
> />Alternative<br />), what do I need to do?
> 
> I hope I am asking this question correctly.  If not, please feel free to flame me.
> 
> Nick
> 
> 
Thread
CheckboxesNicholas Vettese26 Jul
  • Re: CheckboxesPeter Brawley26 Jul
  • Re: CheckboxesMartin Jespersen26 Jul
RE: CheckboxesGeorge Law26 Jul