not able to write check box output into table
i m not able to write checkbox out put into table filed every
thing is correct pls hel me my code as under
---------------------------
it is add ring.asp
---------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% listing_date=now()%>
<html>
<head>
</script>
<Script language="JavaScript">
function checkData(){
if (document.addring.name.value == "" ||document.addring.name.value=="0") {
alert("Please Enter a ring name")
document.addring.name.focus()
return false}
}
</Script>
<title>Ring Addition Module</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body>
<p align="center"><img src="../images/mainheading.jpg" width="500" height="50">
</p>
<p><img src="../images/subheading.gif" width="800" height="30"></p>
<form action="./save_ring.asp" method="post" name="addring" id="addring" onsubmit="return checkData()">
<table width="355" height="275" border="0">
<tr>
<td width="84"><b>Ring
Name </b> </td>
<td width="261"><input name="ring_name" type="text" size="20"></td>
</tr>
<tr>
<td><b>Description</b></td>
<td><textarea name="desc" id="textarea"></textarea></td>
</tr>
<tr>
<td width="84" height="37"><p><b>Size(s) W:</b></p>
<td>
5<input name="chk1" type="checkbox" value="5">
5.5<input name="s2" type="checkbox" value="5.5">
6<input name="s3" type="checkbox" value="6">
6.5<input name="s4" type="checkbox" value="6.5">
7<input name="s5" type="checkbox" value="7">
7.5<input name="s6" type="checkbox" value="7.5">
8<input name="s7" type="checkbox" value="8">
8.5<input name="s8" type="checkbox" value="8.5">
9<input name="s9" type="checkbox" value="9">
9.5<input name="s10" type="checkbox" value="9.5">
</td>
</tr>
<tr>
<td><b>Price</b></td>
<td><input name="price" size="10" type="text"></td>
</tr>
<tr>
<td><b>Karat</b></td>
<td><input type="text" name="karat"></td>
</tr>
<tr>
<td><b>Opening Qty</b></td>
<td><input name="opqty" type="text" size="10"></td>
</tr>
<td><b>Listing Date</b></td>
<td><input name="listing_date" type="text" value="<% = listing_date%>" ></td><tr></tr>
<td><input name="Submit" type="submit" style="BACKGROUND-COLOR: #98BADC; BORDER-BOTTOM-COLOR: #69f; BORDER-BOTTOM-STYLE: outset; BORDER-LEFT-COLOR: #69a; BORDER-LEFT-STYLE: outset; BORDER-RIGHT-COLOR: #69f; BORDER-RIGHT-STYLE: outset; BORDER-TOP-COLOR: #69f; BORDER-TOP-STYLE: outset; COLOR: #fff; FONT-WEIGHT: bold" value="Add"></td>
</table>
<table width="453" border="0">
<tr>
<td>
<%if request("check")="1" then%>
<strong> *Ring Name exist Choose different name!</strong>
<%elseif request("check")="2" then%>
Successfully Added to Database
<%
else
end if%>
</td>
</tr>
</table>
</form>
</body>
</html>
</head>
----------------------------
and this is save ring .asp which will run after add button
<%if session("granted") = false then
response.redirect("unauth.htm")
else
'on error resume next
dim rs
ring_name=request.Form("ring_name")
set rs = server.CreateObject("Adodb.Recordset")
rs.open ("Select * from tblRings where name = '" & ring_name & "'"), conn,1,3
if rs.eof<>true and rs.bof<>true then
response.Redirect("add_ring.asp?check=1")
rs.close
set rs=nothing
else
dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
objRS.open "tblRings", conn, adOpenForwardOnly, adLockOptimistic, adCmdTable
objRS.AddNew
objRS("name")=request.Form("ring_name")
objRS("desc")=request.Form("desc")
if request("chk1") = true then
objRS("size1")=request.Form("chk1")
end if
if request.Form("s2") = "on" then
objRS("size2")=request.Form("s2")
end if
if request.Form("s3") = "on" then
objRS("size3")=request.Form("s3")
end if
if request.Form("s4") = "on" then
objRS("size4")=request.Form("s4")
end if
if request.Form("s5") = "on" then
objRS("size5")=request.Form("s5")
end if
if request.Form("s6") = "on" then
objRS("size6")=request.Form("s6")
end if
if request.Form("s7") = "on" then
objRS("size7")=request.Form("s7")
end if
if request.Form("s8") = "on" then
objRS("size8")=request.Form("s8")
end if
if request.Form("s9") = "on" then
objRS("size9")=request.Form("s9")
end if
if request.Form("s10") = "on" then
objRS("size10")=request.Form("s10")
end if
objRS("listing_date")=request.Form("listing_date")
objRS("price")=request.Form("price")
objRS("qty")=request.Form("opqty")
objRS.update
objRS.close
set objRS=nothing
'response.Redirect("saveimage.asp")
response.Redirect("add_ring.asp?check=2")
end if
conn.close
end if%>
pls help me whats wrong and if u know the better solution pls teach me
thanks
|