How to take the value of a text box and upload to the database in classic asp

466 Views Asked by At

How do I grab the value of poNo text box and update it to the database. I tried grabbing the value with ' request.Form("poNo") ' , but it didnt work...

please help!

<html>
<head>
<body>
  <%
     if(Request.ServerVariables("REQUEST_METHOD") = "POST") then
       updateInvoice = "Update unassignedinvoice set poNo='" & request.Form("poNo") & "')  where id=" & Request.QueryString("UO")
       adoConn.execute updateInvoice
     end if 
  %>

<form action="view_unapproved_invoices.asp?UO=<%response.Write(request.QueryString("UO"))%>"  enctype="multipart/form-data" method="POST">

  <% 
    invoicesSQL = "Select pono from unassignedinvoice where id = " & Request.QueryString("UO")
    set adoRSinvoices = Server.CreateObject("ADODB.Recordset")
    adoRSinvoices.open invoicesSQL, adoConn
  %>

  <table>
  <tr>
  <td style="text-align: left"> PO Number </td>
        <td> 
            <input id="poNo" type="text" value='<%=adoRSinvoices.fields("pono")%>' 
                align="right" /></td>
    </tr>
    <tr>
      <td> 
              <input id="Submit" align="right" type="submit" value="Upload" />  
       </td>
    </tr>
  </table> 

 </form>
</head>
</body>
</html>
1

There are 1 best solutions below

0
On BEST ANSWER

Any reason why you have specified enctype="multipart/form-data" in the form tag ?

If you remove that, it should work.

If you need that ,ie. if you are uploading a file in this page, then you will have to access the form fields according to the component you are using to upload the file