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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign variables as URL parameters?

Status
Not open for further replies.

morph

ISP
May 2, 2001
3
0
0
ES
I have a search.asp with textfields that you fill in and submit it through a form.
then the results.asp ask for the criteria with "Request.Form (fieldsname)"and displays the results.
I also have edit_results.asp which according the id of the record alloud you to change the values of the fields.Then the new data submitted and I WANT TO "response.Redirect(results.asp)" through a form with parameters the criteria that user made the query before.The changes applied but the redirection didn't work because the variables in results wait for request.form and not any URLparameter.Could someone tell me how to be able to apply to the same varaibles,values from url and the same time from the textfields?
 
tack them on the end of the url:

mypage.htm?var1=value1&var2=value2

then access var1 in the server script like so:

var1 = Request.QueryString("var1") jared@aauser.com
 
this is from result.asp <form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;jobsearchresults.asp?ln=<% =title1%>,em=<%= loc1%>,cat=<%=categ1%>,dd1=<%=dapo1%>,dd2=<%=dapa%>, dd3=<%=dapb%>,dd4=<%=dapc%>,dd5=<%=dapd%>,dd6=<%=dape%>&quot;>
this is from results.aspdim ln,em,cat,dd1,dd2,dd3,dd4,dd5,dd6,ddapo,ddews

ddapo=&quot;&quot;
ddews=&quot;&quot;

ln=Cstr(Request.Form(&quot;jobfield&quot;))
em=Cstr(Request.Form(&quot;locfield&quot;))
cat=Cstr(Request.Form(&quot;categfield&quot;))

dd1=Cstr(Request.Form(&quot;d1&quot;))
dd2=Cstr(Request.Form(&quot;d2&quot;))
dd3=Cstr(Request.Form(&quot;d3&quot;))
dd4=Cstr(Request.Form(&quot;d4&quot;))
dd5=Cstr(Request.Form(&quot;d5&quot;))
dd6=Cstr(Request.Form(&quot;d6&quot;))


set Rset0 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Rset0.ActiveConnection = &quot;dsn=xxxx;uid=xx;&quot;

dim whereclause
whereclause=&quot;&quot;

if (ln<>&quot;&quot;) then
whereclause=whereclause + &quot; jtitle LIKE '%&quot;+Cstr(ln)+&quot;%'&quot;
end if

if(em<>&quot;&quot;) then
if whereclause=&quot;&quot; then
whereclause=whereclause + &quot; jlocation LIKE '%&quot;+Cstr(em)+&quot;%'&quot;
else
whereclause=whereclause + &quot; AND jlocation LIKE '%&quot;+Cstr(em)+&quot;%'&quot;
end if
end if

if(cat<>&quot;&quot;) then
if whereclause=&quot;&quot; then
whereclause=whereclause + &quot; jobcategID = '&quot;+Cstr(cat)+&quot;'&quot;
else
whereclause=whereclause + &quot; AND jobcategID= '&quot;+Cstr(cat)+&quot;'&quot;
end if
end if

if ((dd3<>&quot;errordate&quot;) AND (dd4<>&quot;errordate&quot;) AND (dd6<>&quot;errordate&quot;)) then
ddapo=dd5&amp;&quot;/&quot;&amp;dd4&amp;&quot;/&quot;&amp;dd6

if whereclause=&quot;&quot; then
whereclause=whereclause + &quot; jendate >= '&quot; &amp; ddapo &amp;&quot;'&quot;
else
whereclause=whereclause + &quot; AND jendate >= '&quot;&amp; ddapo &amp;&quot;'&quot;
end if
end if

if ((dd1<>&quot;errordate&quot;) and (dd2<>&quot;errordate&quot;) and (dd3<>&quot;errordate&quot;)) then
ddews=dd2&amp;&quot;/&quot;&amp;dd1&amp;&quot;/&quot;&amp;dd3
if whereclause=&quot;&quot; then
whereclause=whereclause + &quot; jendate <= '&quot; &amp; ddews &amp; &quot;'&quot;
else
whereclause=whereclause + &quot; AND jendate <= '&quot;&amp; ddews &amp; &quot;'&quot;
end if
end if

if whereclause=&quot;&quot; then
Rset0.Source = &quot;SELECT * FROM dbo.JOBOPP&quot;
else
Rset0.Source = &quot;SELECT * FROM dbo.JOBOPP WHERE&quot; + whereclause
end if

Rset0.CursorType = 0
Rset0.CursorLocation = 2
Rset0.LockType = 3
Rset0.Open
Rset0_numRows = 0
Response.Write(Rset0.Source)
if ((Rset0.EOF)AND (Rset0.BOF)) then
error=&quot;1&quot;
else
error=&quot;0&quot;
end if

%>


PLEASE WHERE is the mistake?
 
Don't forget to URLEncode the variables values at first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top