I have a textbox where it stores in a user’s option. The possible options are options 3 all the way to 26, ‘True or False’ and ‘Yes or No’.
<input type="text" name="gridValues" class="gridTxt maxRow" readonly="readonly" />
Now in my database I have a table known as ‘Options’ which contains an ‘OptionId’ and ‘OptionType’ fields. The rows in the table is like this below:
OptionId OptionType
O1 A-C
O2 A-D
O3 A-E
...
O24 Yes or No
Now what I want to do if it is possible is that I want options 3-26 and options ‘True or False’ and ‘Yes or No’ from the application to link with an ‘OptionId’ from the database.
For example:
If textbox equals 3 then this equals OptionId 'O1'
If textbox equals 4 then this equals OptionId 'O2'
If textbox equals 5 then this equals OptionId 'O3'
...
If textbox equals Yes or No then this equals OptionId 'O24'.
I want this to happen because when I INSERT VALUES, I want to INSERT the ‘OptionId’ in other database tables when I need to.
Is this possible to do and if so does anyone know how to link the textbox value to the ‘OptionId’ and then INSERT it into a database table known as ‘Questions’?
If I understand correctly your problem then you want to an insert in one table based on another table’s value, this can be done with an INSERT SELECT as in