Jump to content

post checkbox value to db


Matar

Recommended Posts

hi i want to post the checkbox value to my access db , and i check the recored in the db for yes or no , please sent to me a small example for checkbox and radiothank you

HTML FORM PAGE:<FORM action="http://www.yoursite.com/db_add.asp" method="get"><input type="checkbox" name="checkboxname"><input type="submit" value="submit"></FORM>db_add.asp:
<%	var checkboxvalue	checkboxvalue=request.querystring("checkboxname")  if checkboxvalue<>"" then  	var_dbaddvalue="yes"  else  	var_dbaddvalue="no"  end if	end if	set conn=Server.CreateObject("ADODB.Connection")	conn.Provider="Microsoft.Jet.OLEDB.4.0"	conn.Open "D:\DATABASE PATH.mdb"		sql="INSERT INTO table_name (field_name)	sql=sql & " VALUES "	sql=sql & "('" & var_dbaddvalue & "')"	on error resume next	conn.Execute sql,recaffected  if err<>0 then    	Response.Write("Error")  else     	Response.Write("OK")  end if	conn.close%>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...