Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing a form value through querystring

Status
Not open for further replies.

craigward

Programmer
Nov 13, 2007
230
GB
Hi,
I have been trying to pass the value of a text field through an asp querystring, if anyone can tell me what i am doing wrong, i would be very grateful.


I am getting no results or errors. If i do a test query hiddenvalue=test it works fine.

Thanks

Code:
        Response.Write "<a href='" & Request.ServerVariables("SCRIPT_NAME")&"?Query=" & request.querystring("Query")&"&sqlquery="&(Session("test"))&"&records=" & abspage + 1 & "&hiddenvalue='+document.results.compareitems.value'" & "'>Next Page</a>"
 
[tt]Response.Write "<a href='#' onclick='window.location=""" & _
Request.ServerVariables("SCRIPT_NAME") & "?Query=" & _
server.UrlEncode(request.querystring("Query")) & _
"&sqlquery=" & server.UrlEncode(Session("test")) & _
"&records=" & (cint(abspage) + 1) & _
"&hiddenvalue=""+encodeURIComponent(document.results.compareitems.value)"";return false;""" & _
"'>Next Page</a>"
[/tt]
ps: abspage is assumed to be an integer/numeric.
 
Amendment
Upon re-reading what I posted, I find that I'd missed out a "+" on this line.
[tt] "&hiddenvalue=""+encodeURIComponent(document.results.compareitems.value)[COLOR=red yellow]+[/color]"";return false;""" & _[/tt]
 
Thanks for that. I had an error when i tried it last night but i will test it again now and will let you know the outcome.

Thanks again
 
That works great. Thank you for helping. I would like if possible to pick your brain on what i am doing.

I have built a form where a user can build a query from a SQL database, i will paste the code below, but there is a lot. For example, they select a field from a dropdown, then they select and operator from the next dropdown, then they can free type the text that they want to find in the db. I have 5 rows, so they can build in-depth queries.

When the results are displayed, this is all on the same page by the way. Each row that displays contact information has a checkbox next to it holing the uniqueid of the specific contact.

The user can then tick selected contacts on the first page, using the code you helped me with they can go to the next page of results and select some more records and so on. Each page they get to i have tried to build a session variable, using the code you helped with, to capture the hidden uniqueid's that are passed by the querystring. Unfortunately, the session, and i think this happens because i am passing the session to itself on the same page, so all it does is updates with the new id's from the current records, overwriting the ones from the previous page. Hope you are still with me here :p so that’s problem one.

Code used to build session var

Code:
contactids = Request.QueryString("hiddenvalue")
contactids = contactids + Session("myRunningCount")
	
' Update the global variable
Session("myRunningCount") = contactids
response.write(Session("myRunningCount") )

Problem two is, the user might decide to navigate back through the record set to page 1 and untick some of the selected contacts, and this could be done on any page. At this point i will need to take the unselected ids and remove them from the session variable, providing i can first get it to capture them (problem one!).

Once this is resolved i have built an array that splits the id's and inserted them in to a table.

The JavaScript i used that i thought was going to re-populate the checkboxes dependant on the page the user navigates to i found here:
There is a problem three :p The JavaScript i used from teh link above updates a text field with the contacts uniqueid's, but you have to select the first record on the page for it to store any of the others, so if i tick record 2 on page one the field will not take the uniqueid.... i then tick record one and from then on any that i tick update the field.

I'll be the first to admit that this is outside of my comfort zone, but i think at the end of it my knowledge is going to be greatly improved.

Any advice you have on this would be valued. Thanks a lot.


All the code from the page

Code:
<%@ LANGUAGE = VBScript %>
<!--#include file="includes/connection.asp"-->

<%


'SETS THE NOTVALUE TO <> FOR THE QUERY PROCESS
If Request.Form("not1") = "on" Then not1 = "<>" End If
If Request.Form("not2") = "on" Then not2 = "<>" End If
If Request.Form("not3") = "on" Then not3 = "<>" End If
If Request.Form("not4") = "on" Then not4 = "<>" End If
If Request.Form("not5") = "on" Then not5 = "<>" End If

'TESTER FORINDIVIDUAL FIELD ELEMENTS

'response.write(Request.Form("select1"))& "<br />"
'response.write(Request.Form("userselect1"))& "<br />"
'response.write(Request.Form("andor1"))& "<br />"
'response.write(not1)& "<br />"
'response.write(Request.Form("not1"))& "<br /><br />--------------<br />"

'response.write(Request.Form("select2"))& "<br />"
'response.write(Request.Form("userselect2"))& "<br />"
'response.write(Request.Form("andor2"))& "<br />"
'response.write(not1)& "<br />"
'response.write(Request.Form("not1"))& "<br /><br />--------------<br />"

'response.write(Request.Form("andor3"))& "<br />"
'response.write(not3)& "<br />"
'response.write(Request.Form("select3"))& "<br />"
'response.write(Request.Form("operator3"))& "<br />"
'response.write(Request.Form("userselect3"))& "<br />"
'response.write(Request.Form("not3"))& "<br /><br />--------------<br />"

'response.write(Request.Form("andor4"))& "<br />"
'response.write(not3)& "<br />"
'response.write(Request.Form("select4"))& "<br />"
'response.write(Request.Form("operator4"))& "<br />"
'response.write(Request.Form("userselect4"))& "<br />"
'response.write(Request.Form("not4"))& "<br /><br />--------------<br />"

'response.write(Request.Form("andor5"))& "<br />"
'response.write(not3)& "<br />"
'response.write(Request.Form("select5"))& "<br />"
'response.write(Request.Form("operator5"))& "<br />"
'response.write(Request.Form("userselect5"))& "<br />"
'response.write(Request.Form("not5"))& "<br /><br />--------------<br />"




'THIS WORKS THROUGH EACH VARIATION OF A USERS SLECTION TO MAKE SURE THE CORRECT VALUES ARE PUT THROUGH AND RUN.  TO ADD ADDITIONAL QUERY FIELDS YOU WOULD NEEDTO COPY ONE OF THE SECTIONS BELOW AND CHANGE THE NUMERIC VALUES TO THE NEXT LOGICAL NUMBER I.E. 6  YOU WOULD ALOS NEED TO ADD THE FORM ELEMENT, AGAIN CHANGING THE NUMBERS FOR THE FORM NAMES TO THE NEXT LOGICAL NUMBER, AND LAST OF ALL ADD ADDITIONAL JAVASCRIPT IN THE SAME WAY.

If Request.Form("operator1") = "contains" Then operator1 = "LIKE "&"'%"& Request.Form("userselect1") &"%'" Else If Request.Form("operator1") = "startswith" Then operator1 = "LIKE '"& Request.Form("userselect1") &"%'" Else If Request.Form("operator1") = "" Then operator1 = "= '" & Request.Form("userselect1") &"' OR " &  Request.Form("select1")& " IS NULL" Else If Request.Form("operator1") = "selectoperator1" Then operator1 = "" &" '"&Request.Form("userselect1") &"'" Else operator1 = Request.Form("operator1") &" '"&Request.Form("userselect1") &"'"  End If

If Request.Form("operator2") = "contains" Then operator2 = "LIKE "&"'%"& Request.Form("userselect2") &"%'" Else If Request.Form("operator2") = "startswith" Then operator2 = "LIKE '"& Request.Form("userselect2") &"%'" Else If Request.Form("operator2") = "" Then operator2 = "= '" & Request.Form("userselect2") &"' OR " &  Request.Form("select2")& " IS NULL" Else If Request.Form("operator2") = "selectoperator2" Then operator2 = "" &" '"&Request.Form("userselect2") &"'" Else operator2 = Request.Form("operator2") &" '"&Request.Form("userselect2") &"'"  End If

If Request.Form("operator3") = "contains" Then operator3 = "LIKE "&"'%"& Request.Form("userselect3") &"%'" Else If Request.Form("operator3") = "startswith" Then operator3 = "LIKE '"& Request.Form("userselect3") &"%'" Else If Request.Form("operator3") = "" Then operator3 = "= '" & Request.Form("userselect3") &"' OR " &  Request.Form("select3")& " IS NULL" Else If Request.Form("operator3") = "selectoperator3" Then operator3 = "" &" '"&Request.Form("userselect3") &"'" Else operator1 = Request.Form("operator3") &" '"&Request.Form("userselect3") &"'"  End If

If Request.Form("operator4") = "contains" Then operator4 = "LIKE "&"'%"& Request.Form("userselect4") &"%'" Else If Request.Form("operator4") = "startswith" Then operator4 = "LIKE '"& Request.Form("userselect4") &"%'" Else If Request.Form("operator4") = "" Then operator4 = "= '" & Request.Form("userselect4") &"' OR " &  Request.Form("select4")& " IS NULL" Else If Request.Form("operator4") = "selectoperator4" Then operator4 = "" &" '"&Request.Form("userselect4") &"'" Else operator4 = Request.Form("operator4") &" '"&Request.Form("userselect4") &"'"  End If

If Request.Form("operator5") = "contains" Then operator5 = "LIKE "&"'%"& Request.Form("userselect5") &"%'" Else If Request.Form("operator5") = "startswith" Then operator5 = "LIKE '"& Request.Form("userselect5") &"%'" Else If Request.Form("operator5") = "" Then operator5 = "= '" & Request.Form("userselect5") &"' OR " &  Request.Form("select5")& " IS NULL" Else If Request.Form("operator5") = "selectoperator5" Then operator5 = "" &" '"&Request.Form("userselect5") &"'" Else operator5 = Request.Form("operator5") &" '"&Request.Form("userselect5") &"'"  End If



	' HERE WE BUILD THE QUERY DEPENDANT ON WHAT THE USER HAS SELECTED FROM THE QUERY FORM.  
	If Request.Form("select1") <> "select" Then
		
		qryresult = Request.Form("select1") & " " & (not1) & " " & (operator1)
		 
		 If Request.Form("select1") <> "select" AND Request.Form("select2") <> "select" Then
		
			qryresult = qryresult & " " & Request.Form("andor1") & " " & Request.Form("select2") & " " & (not2) & " " & (operator2)
			
			 If Request.Form("select1") <> "select" AND Request.Form("select2") <> "select" AND Request.Form("select3") <> "select" Then
		
				qryresult = qryresult & " " & Request.Form("andor2") & " " & Request.Form("select3") & " " & (not3) & " " & (operator3)		
			
					If Request.Form("select1") <> "select" AND Request.Form("select2") <> "select" AND Request.Form("select3") <> "select" AND Request.Form("select4") <> "select" Then
					
						qryresult = qryresult & " " & Request.Form("andor3") & " " & Request.Form("select4") & " " & (not4) & " " & (operator4)		
			
							If Request.Form("select1") <> "select" AND Request.Form("select2") <> "select" AND Request.Form("select3") <> "select" AND Request.Form("select4") <> "select" AND Request.Form("select5") <> "select" Then
							
								qryresult = qryresult & " " & Request.Form("andor5") & " " & Request.Form("select5") & " " & (not5) & " " & (operator5)		
			
					End If
				End If
			End If		
		End If		
	End If

				
			
' HERE WE TAKE THE FIELD, IF ANY THAT IS GOIN GTO BE THE SORT FIELD
If Request.Form("orderby") = "" Then orderby = "" Else If Request.Form("orderby") <> "" Then orderby = "ORDER BY"&" "&Request.Form("orderby") End If




If Request.QueryString("sqlquery") <> "" Then

strSQL = Request.QueryString("sqlquery")
strSQL = Replace(strSQL,"""","'")
strSQL = Replace(strSQL,"per","%")
'response.write(strSQL)
'Session("test") = strSQL
'response.write(strSQL)

	contactids = Request.Form("compareitems")
	'contactids = contactids + Session("myRunningCount")
	
	' Update the global variable
	Session("myRunningCount") = contactids
	response.write(Session("myRunningCount"))
	'Start the cleaning processfor the blank spaces and removing  any , to the word  "divide"
	'cleanupcontactid = Session("myRunningCount")
'response.end
Else

'THE FINISHED QUERY
strSQL = "SELECT * FROM wce_contact WHERE " &(qryresult)& " "& (orderby)

test = (Replace(strSQL,"'",""""))
test = (Replace(test,"%","per"))
Session("test") = test

'response.write("b")
	contactids = Request.Form("compareitems")
	'contactids = contactids + Session("myRunningCount")
	
	' Update the global variable
	Session("myRunningCount") = contactids
	response.write(Session("myRunningCount"))
	'response.end
	'Start the cleaning processfor the blank spaces and removing  any , to the word  "divide"
	'cleanupcontactid = Session("myRunningCount")

End If




'TEST THE QUERY AND PRINT TO THE SCREEN


'CONFIGURE RECORD LOCKING AND VARIABLES
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
'Const adCmdTableDirect = &H0200
Const adUseClient = 3
dim strSQL, objRS, I, records
Dim objConnection
Dim abspage, pagecnt, wce_contact

'OPEN THE CONNECTION TO THE DATABASE
objConnection ="PROVIDER=SQLOLEDB;DATA SOURCE=2003SERVER\SQLEXPRESS;UID=sa;PWD=sleoni;DATABASE=dccare_site"

'store the record number in a variable as you will refer to thisa few times later on
records = request.querystring("records")

set objRS = server.CreateObject("ADODB.Recordset")
objRS.PageSize = 25      'this is the amount of records you ned on a page
objRS.CacheSize = 300
objRS.CursorLocation = adUseClient

'open the recordset
objRS.Open strSQL, objConnection, adOpenForwardOnly, adLockReadOnly, wce_contact
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>WiredContact Enterprise</title>

<script type="text/javascript">

function openTarget (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}


function checkAll() {
   var is_checked = document.results.checkbox.checked;
   alert(is_checked);
   var cbs = document.results.elements["uniqueid"];
   for (var i=0; i<cbs.length; i++) {
      cbs[i].checked = is_checked;
      } 
   }
  
function submitform(){
document.results.submit()


return false;
}


function zerocorrection(){

if (mailerlookup.operator1.value == "" && mailerlookup.select1.value == "Rooms_From")
	mailerlookup.userselect1.value = 0;
else if (mailerlookup.operator1.value == "" && mailerlookup.select1.value == "Rooms_To")
	mailerlookup.userselect1.value = 0;
else if (mailerlookup.operator1.value == "" && mailerlookup.select1.value == "Price_From")
	mailerlookup.userselect1.value = 0;
else if (mailerlookup.operator1.value == "" && mailerlookup.select1.value == "Price_To")
	mailerlookup.userselect1.value = 0;
else if (mailerlookup.operator1.value == "" && mailerlookup.select1.value == "Price")
	mailerlookup.userselect1.value = 0;
	
if (mailerlookup.operator2.value == "" && mailerlookup.select2.value == "Rooms_From")
	mailerlookup.userselect2.value = 0;
else if (mailerlookup.operator2.value == "" && mailerlookup.select2.value == "Rooms_To")
	mailerlookup.userselect2.value = 0;
else if (mailerlookup.operator2.value == "" && mailerlookup.select2.value == "Price_From")
	mailerlookup.userselect2.value = 0;
else if (mailerlookup.operator2.value == "" && mailerlookup.select2.value == "Price_To")
	mailerlookup.userselect2.value = 0;
else if (mailerlookup.operator2.value == "" && mailerlookup.select2.value == "Price")
	mailerlookup.userselect2.value = 0;

if (mailerlookup.operator3.value == "" && mailerlookup.select3.value == "Rooms_From")
	mailerlookup.userselect3.value = 0;
else if (mailerlookup.operator3.value == "" && mailerlookup.select3.value == "Rooms_To")
	mailerlookup.userselect3.value = 0;
else if (mailerlookup.operator3.value == "" && mailerlookup.select3.value == "Price_From")
	mailerlookup.userselect3.value = 0;
else if (mailerlookup.operator3.value == "" && mailerlookup.select3.value == "Price_To")
	mailerlookup.userselect3.value = 0;
else if (mailerlookup.operator3.value == "" && mailerlookup.select3.value == "Price")
	mailerlookup.userselect3.value = 0;
	
if (mailerlookup.operator4.value == "" && mailerlookup.select4.value == "Rooms_From")
	mailerlookup.userselect4.value = 0;
else if (mailerlookup.operator4.value == "" && mailerlookup.select4.value == "Rooms_To")
	mailerlookup.userselect4.value = 0;
else if (mailerlookup.operator4.value == "" && mailerlookup.select4.value == "Price_From")
	mailerlookup.userselect4.value = 0;
else if (mailerlookup.operator4.value == "" && mailerlookup.select4.value == "Price_To")
	mailerlookup.userselect4.value = 0;
else if (mailerlookup.operator4.value == "" && mailerlookup.select4.value == "Price")
	mailerlookup.userselect4.value = 0;
	
if (mailerlookup.operator5.value == "" && mailerlookup.select5.value == "Rooms_From")
	mailerlookup.userselect5.value = 0;
else if (mailerlookup.operator5.value == "" && mailerlookup.select5.value == "Rooms_To")
	mailerlookup.userselect5.value = 0;
else if (mailerlookup.operator5.value == "" && mailerlookup.select5.value == "Price_From")
	mailerlookup.userselect5.value = 0;
else if (mailerlookup.operator5.value == "" && mailerlookup.select5.value == "Price_To")
	mailerlookup.userselect5.value = 0;
else if (mailerlookup.operator5.value == "" && mailerlookup.select5.value == "Price")
	mailerlookup.userselect5.value = 0;	
}


var myvalue
function mytester(myvalue,myname){
tester='document.getElementById("'+myname+'").checked'
if (eval(tester))
{
if (document.results.compareitems.value=='')
{

document.results.compareitems.value='/'+myvalue+'/'
//alert(myvalue)
}
else
{
document.results.compareitems.value = document.results.compareitems.value+myvalue+'/'
}
}
else
{
document.results.compareitems.value=document.results.compareitems.value.replace(','+myvalue+',', '');
}
}

function myPopup() {
window.open( "[URL unfurl="true"]http://www.google.com/"[/URL] )
}
</script>

<style type="text/css">
	table.results td
	{ font-family: Verdana;
	font-weight: normal;
	font-size: 11px;
	color: #404040;
	background-color: #fafafa;
	border: 0px #6699CC solid;
	border-collapse: collapse;
	border-spacing: 0px;
	margin-top: 0px;}

	table.query td
	{ font-family: Verdana;
	font-weight: normal;
	font-size: 11px;
	color: #404040;
	background-color: #F7EFCE;
	border: 0px #6699CC solid;
	border-collapse: collapse;
	border-spacing: 2px;
	margin-top: 0px;}

	A:link {text-decoration: none; color: #ff3300;}
	A:visited {text-decoration: none; color: #ff3300;}
	A:active {text-decoration: none; color: #ff3300;}
	A:hover {text-decoration: none; color: #0099cc;}

.btn {
  color: #900;
  background: #F7EFCE;
  font-weight: bold;
  border: 1px solid #900;
}
</style>

</head>

<body bgcolor="#F7EFCE" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="mailerlookup" method="post" action="MailerLookup.asp">
<table width="55%" border="0" class="query" cellspacing="2" cellpadding="2">

<tr>
	<td colspan="5"><h3>Lookup Mailer</h3></td>
</tr>
<tr>
	<td colspan="5"><hr /></td>
</tr>
<tr>
	<td colspan="1" align="center"><b><a href="Mailer.asp">Create new Mailer</a></b></td>
	<td colspan="1" align="center"><b>|</b></td>
	<td colspan="1" align="center"><b><a href="AttachToMailer.asp?type=reviewMailers" target="_blank">Export Mailer contacts to XSL</a></b></td>
	<td colspan="1" align="center"><b>|</b></td>
	<td colspan="1" align="center"><b><a href="MailerReports.asp" target="_blank">Mailer Reports</a></b></td>
</tr>
</table>
<table width="55%" border="0" class="query" cellspacing="2" cellpadding="2">
<tr>
	<td colspan="4"><hr /></td>
</tr>
<tr>
	<td colspan="4">&nbsp;</td>
</tr>
<tr>
	<td colspan="2" class=ContactBoldText align="center">Field</td>
	<td class=ContactBoldText>Operator</td>
	<td class=ContactBoldText>&nbsp;</td>
</tr>
<tr>
	<td>NOT:<input type="checkbox" name="not1" /></td>
	<td>
		<select name="select1">
			<option value="select"></option>
			<option value="Rooms_From">Rooms From</option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="idstatus">Ref Num</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>
	</td>
	<td>
		<select name="operator1">
			<option value="selectoperator1"></option>
			<option value="=">Equal</option>
			<option value="contains">Contains</option>
			<option value=">=">Greater Than</option>
			<option value="<=">Less Than</option>
			<option value="startswith">Starts With</option>
			<option value="">Is Blank</option>
		</select>	
	</td>
	<td>
		<input type="text" size="50" name="userselect1" value="2" />&nbsp;AND <input type="radio" checked name="andor1" value="AND" /> &nbsp; Or: <input type="radio" name="andor1" value="OR" />
	</td>
</tr>

<tr>
	<td>NOT:<input type="checkbox" name="not2" /></td>
	<td>
		<select name="select2">
			<option value="select"></option>
			<option value="idstatus">Ref Num</option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="Rooms_From">Rooms From</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>
	</td>
	<td>
		<select name="operator2">
			<option value="selectoperator2"></option>
			<option value="=">Equal</option>
			<option value="contains">Contains</option>
			<option value=">=">Greater Than</option>
			<option value="<=">Less Than</option>
			<option value="startswith">Starts With</option>
			<option value="">Is Blank</option>
		</select>	
	</td>
	<td>
		<input type="text" size="50" name="userselect2" value="3" />&nbsp;AND <input type="radio" checked name="andor2" value="AND" /> &nbsp; Or: <input type="radio" name="andor2" value="OR" />
	</td>
</tr>

<tr>
	<td>NOT:<input type="checkbox" name="not3" /></td>
	<td>
		<select name="select3">
			<option value="select"></option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="idstatus">Ref Num</option>
			<option value="Rooms_From">Rooms From</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>
	</td>
	<td>
		<select name="operator3">
			<option value="selectoperator3"></option>
			<option value="=">Equal</option>
			<option value="LIKE">Contains</option>
			<option value=">=">Greater Than</option>
			<option value="<=">Less Than</option>
			<option value="STARTSWITH">Starts With</option>
			<option value="">Is Blank</option>
		</select>	
	</td>
	<td>
		<input type="text" size="50" name="userselect3" />&nbsp;AND <input type="radio" checked name="andor3" value="AND" /> &nbsp; Or: <input type="radio" name="andor3" value="OR" />
	</td>
</tr>


<tr>
	<td>NOT:<input type="checkbox" name="not4" /></td>
	<td>
		<select name="select4">
			<option value="select"></option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="idstatus">Ref Num</option>
			<option value="Rooms_From">Rooms From</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>
	</td>
	<td>
		<select name="operator4">
			<option value="selectoperator4"></option>
			<option value="=">Equal</option>
			<option value="LIKE">Contains</option>
			<option value=">=">Greater Than</option>
			<option value="<=">Less Than</option>
			<option value="STARTSWITH">Starts With</option>
			<option value="">Is Blank</option>
		</select>	
	</td>
	<td>
		<input type="text" size="50" name="userselect4" />&nbsp;AND <input type="radio" checked name="andor4" value="AND" /> &nbsp; Or: <input type="radio" name="andor4" value="OR" />
	</td>
</tr>


<tr>
	<td>NOT:<input type="checkbox" name="not5" /></td>
	<td>
		<select name="select5">
			<option value="select"></option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="idstatus">Ref Num</option>
			<option value="Rooms_From">Rooms From</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>
	</td>
	<td>
		<select name="operator5">
			<option value="selectoperator5"></option>
			<option value="=">Equal</option>
			<option value="LIKE">Contains</option>
			<option value=">=">Greater Than</option>
			<option value="<=">Less Than</option>
			<option value="STARTSWITH">Starts With</option>
			<option value="">Is Blank</option>
		</select>	
	</td>
	<td>
		<input type="text" size="50" name="userselect5" /><!--&nbsp;AND <input type="radio" checked name="andor5" value="AND" /> &nbsp; Or: <input type="radio" name="andor5" value="OR" />-->
	</td>
</tr>

<tr>
	<td colspan="2" align="left">Select the sort field:&nbsp;
		<select name="orderby">
			<option value=""></option>
			<option value="TypeofHome">Type of Home</option>
			<option value="Contact_Type">Contact Type</option>
			<option value="idstatus">Ref Num</option>
			<option value="Rooms_From">Rooms From</option>
			<option value="Rooms_To">Rooms To</option>
			<option value="Price_From">Price From</option>
			<option value="Price_To">Price To</option>
			<option value="Price">Price</option>
			<option value="Geography">Location</option>
		</select>	</td>
	<td colspan="2" align="center"><input type="submit" onFocus="zerocorrection()" class="btn" value="Run Query" /></td>
</tr>
<tr>
	<td colspan="4"><hr /></td>
</tr>
</table>
</form>
<form name="results" method="post" onSubmit="openTarget(this, 'width=400,height=400,resizable=1,scrollbars=1'); return true;" target="newpopup" action="AttachToMailer.asp?type=SearchMailers">

<!--<form name="results" method="get" action="MailerLookup.asp">-->
<table width="90%" class="results">
<%

	
	contactids = Request.QueryString("hiddenvalue")
	contactids = contactids + Session("myRunningCount")
	
	' Update the global variable
	Session("myRunningCount") = contactids
response.write(Session("myRunningCount") )
%>
<tr>
	<td colspan="6"><input type="text" name="compareitems" onClick="blah()" /><a href="#" onclick="myPopup()">test</a></td>
</tr>
<tr>
	<td width="2%">&nbsp;</td>
	<td width="15%"><h6>Contact</h6></td>
	<td width="10%"><h6>Rooms From</h6></td>
	<td width="10%"><h6>Ref Num</h6></td>
	<td width="10%"><h6>Price from</h6></td>
	<td width="10%"><h6>Price</h6></td>
</tr>

      <%
      if objRS.EOF and objRS.BOF then
        response.write("Your search has returned no results, ")
        response.write(" please re search the database using a different criteria.")
      else
'***************************************
'start the loop in the recordset here
'***************************************
        If Len(request.querystring("records")) = 0 then
          objRS.AbsolutePage = 1
        Else
          If CInt(request.querystring("records")) <= objRS.PageCount then
            objRS.AbsolutePage = request.querystring("records")
          Else
            objRS.AbsolutePage = 1
          End if
        End if
        abspage = objRS.AbsolutePage
        pagecnt = objRS.PageCount
		
		
'****************ARRAY TO MANAGE CHECKBOXES

'Dim myArray(3)
'myArray(0) = "Item 1"
'myArray(1) = "Item 2"
'myArray(2) = "Item 3"
'myArray(3) = "Item 4"

'Now lets Join them using a comma. You can use any other character that you wish to use
'data = join(myarray, ",")

'Now lets send this data to another page
'Response.redirect "nextpage.asp?data="&data

'Nextpage

'Now lets retrieve the data 
'newdata = request.querystring("data")

'Lets Split them
'newarray = split(newdata,",")

'You can process the data in your array as you like.		

'***************************************
'set this up to mirror what you are wanting in the display
'***************************************	 

        For I = 1 to objRS.PageSize
          If Not objRS.EOF Then


			strBGcolour = "#D0D0D0"
			
Response.Write("<tr><td bgcolor='" & strBGColour & "'><input type='checkbox' id='checkbox1863' name='checkbox1863' value='" & objRS("uniqueid") & "' onClick='JavaScript:mytester(this.value,this.name)' /></td><td bgcolor='" & strBGColour & "'>" & objRS("contact") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("rooms_from") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("idstatus") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("price_from") & "</td><td bgcolor='" & strBGColour & "'>" & objRS("price") & "</td></tr>")

            objRS.movenext
          end if
        Next                       
'***************************************
'end the loop in the recordset here and close the objects
'***************************************

      end if 
    objRS.close
    set objRS = nothing

'********************************************************
'put the navigation links on the bottom of the page here
'********************************************************

      Response.Write "<div align='right'>" & vbcrlf
      Response.Write "<a href='"
      Response.Write "MailerLookup.asp"
      Response.Write "?sqlquery="&(Session("test"))&"&Query=" & request.querystring("Query") & _
      "'>First Page</a>"
      Response.Write " | "
      If abspage = 1 Then
        Response.Write "<span style='color:silver;'>Previous Page</span>"
      Else
        Response.Write "<a href='" & Request.ServerVariables("SCRIPT_NAME")&"?records=" & abspage - 1 &"&sqlquery="&(Session("test"))&"'>Previous Page</a>"
      End If
      Response.Write " | "
      If abspage < pagecnt Then
      '  Response.Write "<a href='" & Request.ServerVariables("SCRIPT_NAME")&"?Query=" & request.querystring("Query")&"&sqlquery="&(Session("test"))&"&records=" & abspage + 1 & "&hiddenvalue= & results.compareitems.Value"&  "' onClick='blah()'>Next Page</a>"

Response.Write "<a href='#' onclick='window.location=""" & _
    Request.ServerVariables("SCRIPT_NAME") & "?Query=" & _
    server.UrlEncode(request.querystring("Query")) & _
    "&sqlquery=" & server.UrlEncode(Session("test")) & _
    "&records=" & (cint(abspage) + 1) & _
	"&hiddenvalue=""+encodeURIComponent(document.results.compareitems.value)+""""" & _ 
    "'>Next Page</a>"	  

      Else
        Response.Write "<span style='color:silver;'>Next Page</span>"
      End If
      Response.Write " | "
      Response.Write "<a href='" & Request.ServerVariables("SCRIPT_NAME")&"?Query=" & request.querystring("Query")&"&sqlquery="&(Session("test"))&"&records=" & pagecnt & "'>Last Page</a>"
      Response.Write "</div>"
	  
'********************************************************
'end the navigation links on the bottom of the page here
'********************************************************
      %>

<tr>
	<td colspan='6' align="right"><input type="checkbox" name="checkbox" onclick="checkAll()" ></td>
</tr>
<tr>
	<!--<td colspan='3' align="right"><a href="#" onClick="myPopup()">Find Mailer to attach to selected lookup</a></td>-->
	<td colspan="6" align="center"><input type="Submit" class="btn" value="Select Mailer" /></td>
</tr>
</table>
</form>
</body>
</html>
<%
'End If
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top