# How to save the checkbox value into database using asp?

**URL:** <https://forum.kirupa.com/t/how-to-save-the-checkbox-value-into-database-using-asp/29780>\
**Category:** Uncategorized\
**Created:** [August 30, 2003, 7:07pm UTC](https://forum.kirupa.com/t/how-to-save-the-checkbox-value-into-database-using-asp/29780 "2003-08-30T19:07:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SBUH](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@SBUH](https://forum.kirupa.com/u/SBUH)\
**Post date:** [August 30, 2003, 7:07pm UTC](https://forum.kirupa.com/t/how-to-save-the-checkbox-value-into-database-using-asp/29780/1 "2003-08-30T19:07:05Z")

</div>

Hello, friends. I have form like

input name=“checkbox1” type=“checkbox” value=""

input name=“checkbox2” type=“checkbox” value=""

I wonder how to save the checkbox value after the user click. I am beginner that I don’t even know what kind of value it should save. Can it be 1 or 0 for check or not?

How should I write the code then?

Thanks in advance and wait for your reply!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 31, 2003, 1:17am UTC](https://forum.kirupa.com/t/how-to-save-the-checkbox-value-into-database-using-asp/29780/2 "2003-08-31T01:17:56Z")

</div>

Ok first for your form:

```auto

input name="checkbox" type="checkbox" value="ck1"

input name="checkbox" type="checkbox" value="ck2"

```

ASP File.

```php

<% @ Language=VBScript %>
<% 
   cbx=Request.Form("checkbox")

   MyPath=Server.MapPath("yourDB.mdb") %>

   Set conn = Server.CreateObject("ADODB.Connection")

   conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
	"DBQ=" & MyPath 

   SQL = "INSERT INTO *table* (*value*) VALUES ('"&cbx&"')"

   Set r = conn.Execute(SQL) 
%>

```

The best way to trouble shoot something like this is before you go ahead and try to insert the actual data, make sure your receiving the variable from your form.

```php

<% @ Language=VBScript %>
<% 
   cbx=Request.Form("checkbox")
%>
<%=cbx%>

```

You should see the correct info from the form.

Also be sure to change the table and value of the SQL statement.

Hope this helps
