Separating out concatenated values in Request.Form

E

eric.goforth

Hello,

I'm working with a classic asp page that calls another classic asp
page. The html in my calling page looks like:


<form method="post"
action="/includes/mypage2.asp?subtype=MyType&amp;ecd=1&amp;eid=97702">

....Do some stuff

<input type="submit" name="btnSubmit" value="MyType">
<input type="hidden" name="PageName" value="/includes/mypage1.asp">
<input type="hidden" name="UrlParms"
value="ID1=97702&amp;ID2=2235"></td>

</form>

Now debugging in Interdev inside the mypage2.asp

I see:

Request.Form("UrlParms") = "ID1=97702&amp;ID2=2235"

Is there any way to easily separate out the ID2? If it was in the
Querystring I could simply do a:

Request.QueryString("ID2")

Thanks,
Eric
 
J

James Jones

what you mean you want to seperate them? if you want them seprate, then
combined try this............


ID1 = Request.QueryString("ID1")
ID2 = Request.QueryString("ID2")
UrlParms = ID1 & "&" & ID2


that separates them so you can use each indvidually, then recombine them
after defning.............im not 100% sure what ur asking, so hope this
helps.



Jay
 
E

eric.goforth

James,

In mypage2.asp I'd like to get the value of ID2, but ID2 isn't in my
query string. It's a hidden control on mypage1.asp that's storing a
concatenated string "ID1=97702&amp;ID2=2235"

In mypage2.asp, I see: Request.Form("UrlParms") = "ID1=97702&ID2=2235"

I can use string manipulation functions to split them, like a Mid() or
Split() (I'd need to double check what I can do in classic asp), but I
wondered if there was a built-in way to do this.

For instance, if "ID1=97702&ID2=2235" was in my query string I could do
Request.QueryString("ID2").

Thanks,
Eric
 
B

Bob Barrows [MVP]

Hello,

I'm working with a classic asp page that calls another classic asp
page. The html in my calling page looks like:


<form method="post"
action="/includes/mypage2.asp?subtype=MyType&amp;ecd=1&amp;eid=97702">

...Do some stuff

<input type="submit" name="btnSubmit" value="MyType">
<input type="hidden" name="PageName" value="/includes/mypage1.asp">
<input type="hidden" name="UrlParms"
value="ID1=97702&amp;ID2=2235"></td>

If you think you are providing some sort of security by doing this, then
think again.
</form>

Now debugging in Interdev inside the mypage2.asp

I see:

Request.Form("UrlParms") = "ID1=97702&amp;ID2=2235"

Is there any way to easily separate out the ID2? If it was in the
Querystring I could simply do a:

Request.QueryString("ID2")

dim ar,arid2,id2
ar=split(Request.Form("UrlParms"),"&amp;")
arid2=Split(ar(1),"=")
id2=arid2(1)

You'll need to supply some error-handling as well as some checks that
the arrays that result from the split method contain the expected number
of elements.
 
J

James Jones

you cant split the string in mypage1.asp?




James,

In mypage2.asp I'd like to get the value of ID2, but ID2 isn't in my
query string. It's a hidden control on mypage1.asp that's storing a
concatenated string "ID1=97702&amp;ID2=2235"

In mypage2.asp, I see: Request.Form("UrlParms") = "ID1=97702&ID2=2235"

I can use string manipulation functions to split them, like a Mid() or
Split() (I'd need to double check what I can do in classic asp), but I
wondered if there was a built-in way to do this.

For instance, if "ID1=97702&ID2=2235" was in my query string I could do
Request.QueryString("ID2").

Thanks,
Eric
 
E

eric.goforth

Hello,

I guess that I'll have to do a split then. I'm working in a pretty big
classic asp application. For some new functionality, I need to get the
value of ID2 in mypage2.asp. The code concatenating ID1 and ID2 in the
URLparams hidden variable in mypage1.asp was already there. I'd rather
not change it, since I don't want to risk breaking something else.

-Eric
 
E

Evertjan.

wrote on 22 jun 2006 in microsoft.public.inetserver.asp.general:
[please do not toppost on usenet]
In mypage2.asp I'd like to get the value of ID2, but ID2 isn't in my
query string. It's a hidden control on mypage1.asp that's storing a
concatenated string "ID1=97702&amp;ID2=2235"

In mypage2.asp, I see: Request.Form("UrlParms") = "ID1=97702&ID2=2235"

I can use string manipulation functions to split them, like a Mid() or
Split() (I'd need to double check what I can do in classic asp), but I
wondered if there was a built-in way to do this.

For instance, if "ID1=97702&ID2=2235" was in my query string I could
do Request.QueryString("ID2").

try:

result = myRequestform("UrlParms","ID2")

function myRequestform(a,b)
temp = "&" & Request.Form(a) & "&"
n = instr(temp,"&"&b&"=")
if n=0 then myRequestform ="":exit function
n = n + len("&"&b&"=")
temp = mid(temp,n)
n = instr(temp,"&")-1
myRequestform = left(temp,n)
end function

partly tested
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top