473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

if checkbox true insert value problem ?

Fary4u
273 100+
Hi

is any body know where is actual problem is coz it's look me some problem ?
to insert value into the MS ACCESS DATABASE after the value is true form html


Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="checkbox" name="1" value="1">
  3. <input type="checkbox" name="2" value="2">
  4.  
  5. st1 = Request.Form("1")
  6. st2 = Request.Form("2")
  7.  
  8. If st1 = "True" Then
  9.             sql = "INSERT INTO Search(v) values " _
  10.                       & "( '" & st1 & "')"
  11.             response.write "insert value 1"
  12. end if
  13. else If st2 = "True" Then
  14.             sql = "INSERT INTO Search(v) values " _
  15.                       & "( '" & st2 & "')"
  16.             response.write "insert value 2"
  17. end if
  18.  
  19.  
but after true value it has to be insert the value into the specificed field ?
Oct 15 '07 #1
1 2836
markrawlingson
346 Expert 100+
2 problems here..

1. Checkboxes, by default, return a value of "on" if they are checked, and do not return any value if they are not checked. However, since you are supplying a value for your checkboxes, they will return that value if they are checked, rather than "on", and will not return a value if they are not checked. So first of all you are checking to see if the checkboxes are "true" which they aren't.

Second thing is that your if.. else.. statement is wrong.

try the following..

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="1" value="1">
  2. <input type="checkbox" name="2" value="2">
  3.  
  4. st1 = Request.Form("1")
  5. st2 = Request.Form("2")
  6.  
  7. If st1 = "1" Then
  8.             sql = "INSERT INTO Search(v) values " _
  9.                       & "( '" & st1 & "')"
  10.             response.write "insert value 1"
  11. end if
  12. If st2 = "2" Then
  13.             sql = "INSERT INTO Search(v) values " _
  14.                       & "( '" & st2 & "')"
  15.             response.write "insert value 2"
  16. end if
  17.  
hope this helps.
Sincerely,
Mark
Oct 15 '07 #2

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

Similar topics

1
by: nicholas | last post by:
I am using Obout TreeView: www.obout.com I would like to implement a page to add and remove categories to a product with the Obout Treeview with checkboxes. Does anyone allready did this and...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I have two checkboxes in each row of a grid. One for Modify and another one for View. If I click Modify the View should get automatically checked and should be disabled. Earlier I did this in...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
4
by: Hexman | last post by:
Hello All, I'd like to find out the best way to add a cb column to a dgv and process efficiently. I see at least two ways of doing it. ------------------------------- 1) Add a cb to the dgv,...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
11
by: TechnoAtif | last post by:
INSERT AND UPDATE MULTIPLE CHECKBOX DATA USING PHPMYSQL OR JAVASCRIPT Hi All I want to check the multiple checkboxes update them after revisiting that page. I am taking the name as...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
13
by: ramprakashjava | last post by:
hi, i hav "java.lang.NullPointerException" error while Deleting table records using checkbox in jsp here i enclosed files help quickly plzzz.. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.