Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

trouble with search box

Posted on 2006-11-05
1
Medium Priority
?
212 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
[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
1 Comment
 
LVL 7

Accepted Solution

by:
jay_eire earned 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

671 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