By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,726 Members | 2,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,726 IT Pros & Developers. It's quick & easy.

How to insert the checkbox values into database?

P: 1
Hii Everyone

I am having a problem while inserting the checkbox values into database after posting. I am actually getting the Checkbox fields from Database .Now I want to insert the Checked field values into Database from next page.Please help me how to Loop and get the Check box values in a String.

I am also passing a Hard Coded Text (A and E) along with the Chkbox Value.How do i split it in the Loop and insert Application Code and the hard coded text as Seperate Values....

Expand|Select|Wrap|Line Numbers
  1. <table border="1" width="85%" cellspacing="0" cellpadding="0">
  2.  
  3.     <td width="50%" align="center"><b>Application Name</b></td>
  4.     <td width="26%" align="center"><b>Maker</b></td>
  5.     <td width="24%" align="center"><b>Authoriser</b></td>
  6.   </tr>
  7.                   <%
  8.          SFT = "select app_id,app_name from mstrdb.app_mstr where app_id in (select app_id from mstrdb.APP_BRNCH_ACCESS_MSTR where (using_sol='" & emp_brnch & "' or using_sol='ALL')) and status='Y' order by app_name"
  9.          set objrs1= objConn.execute(SFT)     
  10.         'response.write SFT
  11.  
  12.             Dim i
  13.             Dim tot1
  14.             Dim totval
  15.  
  16.                 i = 1
  17.  
  18.                 Do WHILE NOT objrs1.EOF
  19.                 totval = int(objrs1.RecordCount)
  20.                 tot1 = 0
  21.  
  22.  
  23.  
  24.             %>
  25.  
  26.  
  27.   <tr>
  28.     <td width="50%"><% = ucase(objrs1(1)) %></td>
  29.     <td width="26%" align="center">
  30.     <input type="radio" value="<%=objrs1(0) & "-E"%>" name="cb<%=i%>"></td>
  31.     <!--input type="text" name="cb<%=i%>" value="<%=objrs1(0) & "-E"%>"></td-->
  32.     <td width="24%" align="center"><input type="radio" name="cb<%=i%>" value="<%=objrs1(0) & "-A"%>"></td>    
  33.     <!--input type="text" name="<% =i%>" value="<%=objrs1(0) & "-A"%>"></td-->
  34.  
  35.   </tr>
  36.  
  37.             <%
  38.                 i = i + 1
  39.             objrs1.MoveNext
  40.             Loop
  41.             %>
  42. </table>
Nov 21 '10 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
It wasn't clear from your post what problem you are having. One common problem I see is having a checkbox return a "yes" value, and needing this stored as "true" or 1 in a db. If that's the problem, try printing out exactly what the form returns like this:
Expand|Select|Wrap|Line Numbers
  1. for each x in request.form
  2.    Response.write x & ": " request.form(x) & "<br>" & vbnewline
  3. Next
then you can check whether the form data is in the best format to put in your db.

Let me know if this answers your question.

Jared
Nov 21 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.