Nick,

It looks like the mysql part has been answered.  I was going to suggest
using a ENUM
field myself.

For the PHP part, if you are trying to keep multiple rows in your HTML
correlated,
ie $customer[1] = $mod_type[1] you may not want to use a checkbox field

checkbox fields only pass a field if they are checked - so if you have
information
for customer[0], and the checkbox is not checked, then $mod_type[0]
would NOT be from the first
row, it would be from the first CHECKED row.

The best solution I have found is to use a RADIO button with the value
set to the default. 
this way it always gets a value. I have seen others suggest to using a
hidden field
to preset this field so there is always a value -- 
<input type="hidden" name="mod_type_0" value="other"/>
<input type="checkbox" name="mod_type_0" value="alternative"
/>Alternative<br />)

This way, if the checkbox is unchecked, it gets a value of "other", but
if it is
checked, it will pass a value ot "alternative".

Note - I am not sure how this would work with an array (mod_type[]).
PHP might treat
the hidden field as index 0, and if the checkbox is checked, it would be
index 1


-
George

>>>-----Original Message-----
>>>From: Nicholas Vettese [mailto:[EMAIL PROTECTED] 
>>>Sent: Wednesday, July 26, 2006 12:04 PM
>>>To: mysql@lists.mysql.com
>>>Subject: Checkboxes
>>>
>>>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
>>>
>>>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to