Radio Buton - SQL DB Field Type - Checkbox DB Field Type.

I have this test form.  I would like to insert the data into a SQL Table.  I wold like to re-design the SQL Table.  Please help me on the Field type for YES  NO then for the checkbox.

I would like to create a SQL Table.

Into my design, for question 1 which field structure I should have for a radio button and how many field I should have for a checkbox button and type please.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<html>
<head>
<title>Form | </title>
</head>

<script type="text/javascript">
// checks buttons (radio, checkbox) - coursesweb.net
function checkButons(frm) {
var re = false;           // used to determine when a button is checked
var err = '';             // to store the errors

var question1 = frm.contactme;          // contains an array with all radio buttons "vegetable"

// create an Array in JSonn format with checkbox buttons
var question2 = [frm.CMTEE_PREF_NEW];

// traverse the radio buttons
// if one is checked sets re to true, and stops the iteration with "break"
for(var i=0; i<question1.length; i++) {
  if(question1[i].checked == true) {
    re = true;
    break;
  }
}

// if "re" is false means no radio button checked, add error in "err" 
if(re == false) err += '- You must check at least one vegetable';

// make "re" again False, and traverse the checkbox buttons
// if one is checked sets re to true, and stops the iteration with "break"
re = false
for(var i=0; i<question2.length; i++) {
  if(question2[i].checked == true) {
    re = true;
    break;
  }
}

// if "re" is false means no checkbox button checked, add error in "err" 
if (re == false) err += '\n - You must check at least one fruit';

// if "err" not empty, alert the error(s) and returns False to stop submitting form
if(err != "") {
  alert(err);
  return false;
}
else return re;
}
--></script>


<body>
<cfform id="f1" name="f1" action="confirmationn_e.cfm" method="POST" onsubmit="return checkButons(this);">
<p><font size=4><strong>Fill out this form: </strong> </font></p>

<p><br>
            <label for="strEmail"><strong><strong>1.</strong> If your skill set is suitable to other committees, </label>
          </p>
          <table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td colspan="2" height="5" width="100%">
                <cfoutput><input type="radio" name="contactme" value="Yes">Yes &nbsp;
                
                <input type="radio" name="contactme" value="No">No<br></cfoutput>
                
                <p><br><label for="strEmail"><strong><strong>2.</strong> Which of the following types of committee would you prefer to serve on?</label>
          </p>
                    
          <table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td colspan="2" height="5" width="100%">
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF1" value="POL">POL          <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF2" value="SOP">SOP                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF3" value="EE">EE<br />
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF4" value="ADMIN" />ADMIN        <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF5" value="TF">TF              <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF6" value="ANY">ANY           <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF7" value="SP">SP
                </td>
            </tr>
          </table>
                   <p align="center">
            <input type="hidden" name="xaction" value="true">
            <input type="submit" value="Submit &raquo;">
            
            &nbsp;&nbsp;
            <input type="reset" value="Reset" name="B2">
          </p>
        </cfform>
</body>
</html>

Open in new window

MyTestFormLayout.jpg
LVL 4
koilaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>which field structure I should have for a radio button
radio buttons are normally used in an option group, which holds a single value of any type, and the user can select any one of those values by selecting the option button.
So ... the type depends on what the values are:  char, varchar, numeric, bit, whatever.

>how many field I should have for a checkbox button and type please.
checkbox = Values are either true or false = SQL bit column.  
This assumes that you don't want to entertain a NULL value.
0
koilaAuthor Commented:
Please review attached layout file and advise how many field I need and type.  I'm new
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Please work with expert comments given and respond in kind.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

koilaAuthor Commented:
Please advice on my question.   Which type of fields I should select for the yes or no.   A boeilan?

How about the check box.  Should I have 6 fields.  For example.

Pol. What type I should have. When the user checked it should show 1 or 0 into the table?
0
Anthony PerkinsCommented:
Skill set = Bit data type
Committee = single tinyint (if not more than 8 options) if more than go with single smallint and use boolean logic as in:
POL = 2 ^ 0 = 1
SOP = 2 ^ 1 = 2
EE = 2 ^ 2 = 4
ADMIN = 2 ^ 3 = 8
TF = 2 ^ 4 = 16
ANY= 2 ^ 5 = 32
SP= 2 ^ 6 = 64
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:
Oops this is a duplicate question see here:
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_28226128.html

I will repeat my comment there so that you can delete this question.
0
koilaAuthor Commented:
I've already accepted the solution that work for me.

thanks.
0
koilaAuthor Commented:
This is not a duplicate question, different technical requirements that I was looking for.

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.