Solved

Passing Values to ASP script from HTML form

Posted on 2000-04-21
2
144 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
2 Comments
 
LVL 11

Accepted Solution

by:
thunderchicken earned 10 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now