Solved

trouble with search box

Posted on 2006-11-05
1
179 Views
Last Modified: 2010-04-25
I'm trying to make a search function for my database. Right now I'm working on a very simple version where the user inputs  a number into a form and the results page is supposed to show the same numebr from the form. For some reason the results page will only display the default number no matter what I input into the search form. Here is the code for my recordset and the two pages. Can someone help me figure out what I'm doing wrong?

Recordset (on results page) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

SELECT ID, item, store, address, description
FROM shoppinglist
WHERE ID = MMColParam

name                 default value                run-time value
MMColParam           1                       Request.QueryString("searchtest")


search page code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="searchtest" name="searchtest" method="post" action="results.asp">
  <label>
  Search
  <input type="text" name="textfield" />
  </label>
  <label>
  <input type="submit" name="Submit" value="Submit" />
  </label>
</form>
</body>
</html>



Results page<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/consearchtest.asp" -->
<%
Dim rssearchtest__MMColParam
rssearchtest__MMColParam = "1"
If (Request.QueryString("searchtest") <> "") Then
  rssearchtest__MMColParam = Request.QueryString("searchtest")
End If
%>
<%
Dim rssearchtest
Dim rssearchtest_numRows

Set rssearchtest = Server.CreateObject("ADODB.Recordset")
rssearchtest.ActiveConnection = MM_consearchtest_STRING
rssearchtest.Source = "SELECT ID, item, store, address, description  FROM shoppinglist  WHERE ID = " + Replace(rssearchtest__MMColParam, "'", "''") + ""
rssearchtest.CursorType = 0
rssearchtest.CursorLocation = 2
rssearchtest.LockType = 1
rssearchtest.Open()

rssearchtest_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="500" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td>test number </td>
  </tr>
  <tr>
    <td><%=(rssearchtest.Fields.Item("ID").Value)%></td>
  </tr>
</table>
</body>
</html>
<%
rssearchtest.Close()
Set rssearchtest = Nothing
%>
0
Comment
Question by:elliottbenzle
1 Comment
 
LVL 7

Accepted Solution

by:
jay_eire earned 500 total points
ID: 17879534
Hi  elliottbenzle,
try this for your form:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="searchtest" name="searchtest" method="post" action="results.asp">
  <label>
  Search
  <input type="text" name="searchtest" />
  </label>
  <label>
  <input type="submit" name="Submit" value="Submit" />
  </label>
</form>
</body>
</html>

You need to give your text field the name searchtest
  <input type="text" name="searchtest" />

Thanks
Jay Eire
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

21 Experts available now in Live!

Get 1:1 Help Now