0

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>
Sash
  • 315
  • 2
  • 6
  • 23
  • I hope this is not production code, did you ever heard of sql injections? Now to your problem: How do you know Request.Form doesn't work? Did you try to show the posted value on the screen or did you only check if your database is updated? Is the name of the page you show 'view_unapproved_invoices.asp? – kloarubeek Jul 25 '14 at 22:57
  • 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 , 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. – Flakes Jul 26 '14 at 07:22
  • @SearchAndResQ that's worthy of an answer, IMO. :) – Shadow The GPT Wizard Jul 27 '14 at 07:55

1 Answers1

1

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

Flakes
  • 2,422
  • 8
  • 28
  • 32