On Monday 26 June 2006 08:03 am, Nicholas Vettese wrote:
> If I have a multiple choice on a form and want to store that in my DB, then
> how should I set up my table?  I have been reading up on these, but
> everyone seems to have a different opinion on how to accomplish this task. 
> What I am looking to do give the user a few options to check when
> submitting a form.

> <select name="sports" multiple id="sport_type">
> <option value="baseball">Baseball</option>
> <option value="football">Football</option>
> <option value="soccer">Soccer</option>
> <option value="hockey">Hockey</option>
> </select>

Hmm, ok...

> Would my table look like this:
>
> ....
> CREATE TABLE sports (
> sports_id int(11) not null auto_incremement,
> sport_name text not null, 

Woh there! TEXT is probably overkill, I'd recommend VARCHAR for that (120 or 
so, 255 if you're feeling lucky).  As far as the sport_name, you could store 
it as lowercase, and use the ucwords (http://www.php.net/ucwords) function in 
PHP to make it uppercase for the values.

> primary key (sports_id)
> );

-- 
Chris White
PHP Programmer/DB BD
Interfuel

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

Reply via email to