Results 1 to 3 of 3

Thread: randyng@pl.jaring.my

  1. #1
    randy Guest

    Default randyng@pl.jaring.my

    Hi everyone, I am trying to send data from radio button in a htm and later to access database (by going through some checking mechanism in asp file)<BR>the question is, how do I set access database to accept data sent by a radio button if access database has the data type set to (yes/no). I understand that if an item were to be (yes) then a tick is place on the database itself. So, how do I send a (yes/no/a tick) to a database???<BR>below are some of the coding which I had done on a htm file, asp file and access database<BR><BR>** can I change the value to something else??? like "hideproductlist_yes" or others??<BR><BR>Hide Product List : <BR>&#060;input type="radio" name="hideproductlist" value="yes"&#062;<BR>Yes <BR>&#060;input type="radio" name="hideproductlist" value="no" checked&#062;<BR>No <BR><BR>Active to be sold in market : <BR>&#060;input type="radio" name="activesold" value="yes" checked&#062;<BR>Yes <BR>&#060;input type="radio" name="activesold" value="no"&#062;<BR>No<BR><BR>Hot Deal : <BR>&#060;input type="radio" name="hotdeal" value="yes"&#062;<BR>Yes <BR>&#060;input type="radio" name="hotdeal" value="no" checked&#062;<BR>No <BR><BR><BR>asp file<BR><BR>&#060;%@ Language = VBScript %&#062;<BR><BR>&#060;% Option Explicit %&#062;<BR><BR>&#060;!-- #include virtual="/adovbs.inc" --&#062;<BR><BR>&#060;%<BR>&#039Declare variable<BR>Dim productCategory, productTitle, productReferenceNo, productBrand, productDescription, productSellingprice, productCostprice, productStock, productImagefile, productView, productActive, productHotdeal<BR>productCategory = Request.Form("Category")<BR>productTitle = Request.Form("Title")<BR>productReferenceNo = Request.Form("referenceno")<BR>productBrand = Request.Form("brand")<BR>productDescription = Request.Form("description")<BR>productSellingprice = Request.Form("sellingprice")<BR>productCostprice = Request.Form("costprice")<BR>productStock = Request.Form("stock")<BR>productImagefile = Request.Form("imagelocation")<BR>productView = Request.Form("hideproductlist")<BR>productActive = Request.Form("activesold")<BR>productHotdeal = Request.Form("hotdeal")<BR>%&#062;<BR>&#060;%<BR>& #039test to see if values are passed correctly from the registration htm file<BR>Response.Write(productCategory & "<BR>")<BR>response.write(productTitle & "<BR>")<BR>response.write(productReferenceNo & "<BR>")<BR>response.write(productBrand & "<BR>")<BR>response.write(productDescription & "<BR>")<BR>response.write(productSellingprice & "<BR>")<BR>response.write(productCostprice & "<BR>")<BR>response.write(productStock & "<BR>")<BR>response.write(productImagefile & "<BR>")<BR>response.write(productView & "<BR>")<BR>response.write(productActive & "<BR>")<BR>response.write(productHotdeal & "<BR>")<BR>%&#062;<BR>&#060;%<BR>&#039make sure all the data was entered<BR>If ((productCategory = "") OR (productTitle = "") _<BR>OR (productReferenceNo = "") OR (productBrand = "") _<BR>OR (productDescription = "") OR (productSellingprice = "") _ <BR>OR (productCostprice = "") OR (productStock = "") _<BR>OR (productView = "") _<BR>OR (productActive = "") OR (productHotdeal = "")) THEN<BR><BR>Response.Write("You must enter values for all the fields. Before entering this page")<BR>Response.End<BR><BR>Else<BR>%&#062;<BR>< BR>&#060;%<BR>&#039Call login function and connection<BR>Dim objConn<BR><BR>&#039Create connection with database using DSN-less connection<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR>"DBQ=C:inetpubwwwrootuser_profile.mdb"<BR>obj Conn.ConnectionTimeout = 15<BR>objConn.CommandTimeout = 30<BR>objConn.Open <BR><BR>&#039Execute strSQL<BR>Dim objRS<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Op en "Product", objConn, , adLockOptimistic, adCmdTable <BR>%&#062;<BR><BR>&#060;%<BR>&#039Declare variable<BR>Dim bolAlreadyExists<BR>bolAlreadyExists = False<BR><BR>Do While Not (objRS.EOF OR bolAlreadyExists)<BR>if (StrComp (objRS ("ProductName"), productTitle, vbTextCompare) = 0) Then<BR><BR>Response.Write ("&#060;A Href=&#039add_new_product_login.html&#039&#062;")< BR>Response.Write ("Title already exists.")<BR>response.Write ("&#060;/A&#062;")<BR>bolAlreadyExists = True<BR><BR>End if<BR><BR>if (StrComp (objRS ("ProductReferenceNumber"), productReferenceNo, vbTextCompare) = 0) Then<BR><BR>Response.Write ("&#060;A Href=&#039add_new_product.html&#039&#062;")<BR>Res ponse.Write ("Reference number already exists.")<BR>response.Write ("&#060;/A&#062;")<BR>bolAlreadyExists = True<BR><BR>End if <BR><BR>objRS.MoveNext<BR><BR>Loop<BR><BR>if NOT bolAlreadyExists Then<BR><BR>objRS.AddNew<BR><BR>objRS("Category_ID ") = productCategory<BR>objRS("ProductName") = productTitle<BR>objRS("ProductReferenceNumber") = productReferenceNo<BR>objRS("ProductBrand") = productBrand<BR>objRS("ProductDescription") = productDescription<BR>objRS("ProductImage") = productImagefile<BR>objRS("ProductSellingPrice") = productSellingprice <BR>objRS("ProductCostPrice") = productCostprice<BR>objRS("Stock") = productStock<BR>objRS("ProductListHidden") = productView<BR>objRS("ProductActive") = productActive<BR>objRS("ProductHotDeal") = productHotdeal<BR><BR>objRS.Update<BR><BR>Response .Write ("Your registration is successful")<BR><BR>End if<BR><BR>End if<BR>%&#062;<BR><BR>&#060;%<BR>objRS.Close<BR>set objRS = Nothing<BR><BR>objConn.Close<BR>set objConn = Nothing<BR>%&#062;<BR><BR>access database<BR>product table<BR><BR>field name data type description<BR>=================================== ===========<BR>Product_ID autonumber<BR>ProductName text<BR>.<BR>.<BR>ProductListHidden (yes/no) <BR>ProductActive (yes/no)<BR>ProductHotDeal (yes/no)<BR><BR>

  2. #2
    vivid Guest

    Default randyng@pl.jaring.my

    Helo and Apa Khabar fellow malaysian? Enough of the introduction :-)<BR><BR>From what I read and correct me if I am wrong, what you are trying to do is to simply place a tick within a database. <BR><BR>Your code was too long and I ended up in a rumah sakit. Just joking there. What you need to do is to dim the function of adding a tick to you database. One example is below<BR><BR> if addtick="on" then<BR> tick="yes"<BR> else<BR> tick="no"<BR> end if<BR><BR>I hope this helps. <BR><BR>v

  3. #3
    randy Guest

    Default to vivid

    huh ... ! how should I set it? since I am using the objRS("Something")=productActive in entering the data! So, how do I set a if else statement into the file???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts