[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Passing Values to ASP script from HTML form

Posted on 2000-04-21
2
Medium Priority
?
152 Views
Last Modified: 2010-04-09
HI

I have an HTML form with text input field, and also a custom button.

I want to have somebody enter a search string in the text field. When the button is pressed I want it to call an asp script, passing the text field value into a SQL query, which is within the asp script.

must be simple to do...?

thanks
0
Comment
Question by:juiceee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
thunderchicken earned 30 total points
ID: 2738131
Your ASP script must be on another page...

so you would call an ASP file, then you use

Request.Form("txtName")

then you open your SQL database with

objrec.open "SELECT * FROM whatever where varname = '" & Request.Form("txtName") & "'", objconn, 2, 2

if you need any other info, lemme know
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2739603
It indeed is simple to do, but you have to keep into account that ASP is server side and therefore this request has to be send to the server and being processed on the server, the page just has to be reloaded.

If your form looks like:

<form action="process.asp" method=post>
<input type=text name="searchstring">
<input type=submit>
</form>

then your asp file should look someting like:

<%
    Dim SearchString, Sql ...etc
    SearchString = request.form("searchstring")
    Sql = "select Name, ID from Person where Name like '%" & SearchString & "%'"
    'Open your connection here, and do all the other stuff

%>

instead of using the POST method you can also use the GET method, but thewn you can't use the request.form("..") but you should use the request.querystring(".."). Also, you don't really have to use the .form or .querystring....just request("...") is enough!
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question