Solved

Passing Values to ASP script from HTML form

Posted on 2000-04-21
2
147 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 10 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
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 embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

726 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