Skip to content
Advertisement

correct way of saving dropdown in php

I am using 2 kinds of dropdowns. The Yes/No and one with multiple values. Either way I use this:

JavaScript

or

JavaScript

The value of the Yes/No I store as a bit (before as tinyint) in my mysql-db. The multiple-choice I store as int. I get the values out of my object $member and try to select the right value:

JavaScript

This works perfectly when I have the multiple choice stored as int but not with the Yes/No stored as bit or tinyint.

What am I doing wrong? The value of $member->active are right. I know Yes/No can be done with a checkbox but I won’t this sorted out first.

Thx

Advertisement

Answer

To provide an answer and assuming you are already loading the appropriate data and storing it into whatever class/object $member is.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement