add a value from html control to SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raghulvarma
    New Member
    • Oct 2007
    • 90

    add a value from html control to SQL

    Is it possible to add a data from html control (input type=" text") to SQL if it is possible then how to do that?
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi raghulvarma,

    It sure is possible; if you have your html control inside a form, then when the form is submitted you can add the value of the control to your sql string. Like so:

    Your form:
    Code:
     
    <form name="form1" action="mypage.asp" method="post">
    <input type="text" name="txtTest" /> 
    <input type="submit" value="Submit" />
    </form>
    Your code that builds the sql string:
    Code:
    <%
    Dim sSQL
    sSQL = "SELECT whatever FROM whereever WHERE something = '" & Request("txtTest") & "' "
    Response.Write sSQL
    %>
    Does this answer your question? Let me know.

    Dr B

    Comment

    Working...