How to create a Submit button for this code.

Discussion in 'C#' started by dsvictoriano, Jan 16, 2009.

  1. #1
    Good day,

    I was trying to finish a small project. Everything went well but i'm kinda lost on the last part :eek: i dont know how to save the data. Can someone help me to finish my code.

    Here is my code :

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    
    
    
    <% @ LANGUAGE="VBSCRIPT" %>
    
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="AUTHOR" content="Dennis Victoriano">
    <title>Article Consumption</title>
    </head>
    <link rel="STYLESHEET" href="/StyleSheetIndex.css">
    
    <body background="/images/BACKGRND.gif" bgcolor="#C0C0C0" text="#000000" link="#000080" vlink="#000080" alink="#FF0000">
    
    <% 
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open SESSION("ConnectionString"),Session("UserName"),Session("PWord")
    %>
    
    <!-- #include virtual="/Functions.inc" -->
    <h3><a href="top"></a>Article Consumption</h3>
    
    
    <form method="post" action="ArticleConsumption.asp" name="MyForm">
    
        <%      
            set Rs = conn.Execute ("Select * from viewShoeStyles where ShoeID = '" & request("ShoeID")&"'")
        %>
    
    <input type="hidden" name="ShoeID" value="<%= request("ShoeID") %>">
        
            <br>
    		<br>
    		<b> Model Name : <%= Rs("ModelName") %></b>
    		<br> <b>Gender : </b><%= Rs("Gender") %> <br>
    		<b> Article # : </b><%= Rs("ShoeID") %><br>
    		<b>Color : </b><%= Rs("Color") %> 
    		<BR>
    
    		<table border="1">
                <tr>
                    <th colspan="2" align="center">Action</th>
                    <th align="center">Component</th>
                    <th align="center">Material Code</th>            
                    <th align="center">Material Description</th>
                    <th align="center">Supplier</th>
                    <th align="center">Width</th>
                    <th align="center">Unit</th>
                    <th align="center">M/SHT</th>
                    <th align="center">Per Pair</th>
                    <th align="center">Remarks</th>
                </tr>
            
            <%
            
                Set CompConn = Server.CreateObject("ADODB.Connection")
                CompConn.Open SESSION("SSV_ConnectionString"),Session("SSV_RuntimeUserName"),Session("SSV_RuntimePassword")
                
                sqlString = "Select * from viewArticleConsumption Where ShoeID = '" & request("ShoeID")
                sqlString = sqlString & "' order by Component"
                
                Set CompRs = CompConn.Execute (sqlString)
                If Not CompRs.EOF then
    			aDetails = CompRs.GetRows
    			iUBoundDetails = UBound(aDetails,2)
    			
    			
    			CompConn.Close 
    										
    			For i = 0 to iUBoundDetails
                sqlString = "?ShoeID=" & trim(aDetails(0,i)) & "&CompID=" & trim(aDetails(2,i)) 
    			Response.Write	" <tr>" & vbcrlf & _
    							" <td align=center colspan=2><a href=ArticleComponentDelete.asp" & sqlString & ">Delete</a></td>" & vbcrlf & _
                                " <td><a href=ArticleComponent.asp" & sqlString & ">" & aDetails(3,i) & "</a></td>" & vbcrlf & _
                                " <td><a href=ArticleMaterial.asp" & sqlString & "&MatID="& trim(aDetails(4,i)) & ">" & aDetails(4,i) & "</a></td>" & vbcrlf & _
    		                    " <td>" & aDetails(5,i) & "</td>" & vbcrlf & _
    		                    " <td><a href=ArticleSupplier.asp" & sqlString & "&SupID="& trim(aDetails(6,i)) & ">" & aDetails(7,i) & "</td>" & vbcrlf & _
                                " <td><input type=text size=5 name=width value=" & aDetails(8,i) & "></td>" & vbcrlf & _
                                " <td><a href=ArticleUnit.asp" & sqlString & "&UomID="& trim(aDetails(9,i)) & ">" & aDetails(10,i) & "</a></td>" & vbcrlf & _
    							" <td><input type=text size=5 name=msht value=" & aDetails(11,i) & "></td>" & vbcrlf & _
    							" <td><input type=text size=5 name=PerPair value=" & aDetails(12,i) & "></td>" & vbcrlf & _
    							" <td><input type=text size=10 name=Remarks value=" & aDetails(13,i) & "></td>" & vbcrlf & _
    							" </tr>" & vbcrlf			
    							
    			next				
    			
    		    end if
            %>            
                <tr>
                    <td colspan="2"><a href="ArticleConsumptionAddComponent.asp?ShoeID=<%= request("ShoeID")%>"> Add Component </a></td>
                </tr>
    		</table>
    		
    		<input type="submit" value=" Submit " name="buttonAdd">
    	</form>	
    <%
    set rs = nothing
    Conn.close
    %>
    
    
    		    
    </body>
    </html>
    
    Code (markup):
     
    dsvictoriano, Jan 16, 2009 IP
  2. dsvictoriano

    dsvictoriano Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    here is the screen shot to give you guys an idea on what i looks like.

    I need to save all the data on the inputbox when i click the Submit button. I have been trying to finish this project for almost a week now :( I hope someone can help me.

    [​IMG]
     
    dsvictoriano, Jan 16, 2009 IP
  3. tihomir_wwf

    tihomir_wwf Active Member

    Messages:
    363
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Hi,

    few suggestion:

    1) Change the input (with type='submit') to asp:Button and add event handler for OnClick.

    2) in the event handler you can get all the information from fields (add attribute runat='server' to them) and to save it file (you need System.IO name space http://msdn.microsoft.com/en-us/library/system.io.aspx

    Good Luck
     
    tihomir_wwf, Jan 25, 2009 IP
  4. cybangerz

    cybangerz Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    create your input form
     
    cybangerz, Jan 30, 2009 IP
  5. Bruce_Davenport

    Bruce_Davenport Guest

    Best Answers:
    0
    #5
    First of all you have to create 1 input form.........!
     
    Bruce_Davenport, Jan 30, 2009 IP
  6. pharmacy

    pharmacy Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i am having the same problem ????
     
    pharmacy, Jan 31, 2009 IP