coding issue

S

Steve G

FP 2002

Hi All:

I have a slightly off-topic question regarding some code I am trying to get
to work.

I am creating an array from a database then a string from the array. the
values are being returned correctly.

arrID = objRs3.GetRows

for a = 0 to uBound(arrID,2)
for b = 0 to uBound(arrID,1)
strVal = strVal & " " & arrID(b,a)
next
strVal = strVal & ","
next
strVal = Left(strVal, Len(strVal) -1)
parArray = split(StrVal, ",")

I am trying to create a parameterized link to another page:

for i = 0 to uBound(parArray)
response.write "<param name='"somevalue"'
value=""http://www.domainname.com/score.asp?par='"&parArray(i)&"' "">"
next

The link is generated, but when I click on it, it goes to the page but the
query string reads:

http://www.domainname.com/score.asp?par=' 2'

Could someone take a look, and tell me where I am going wrong here?

TIA

Steve G
 
J

Jack Brewster

Steve,

First guess is that you're putting a space into the output string, that
would explain the extra %20. Also, in most cases I've seen, it hasn't been
necessary to include the parameters in quotes, i.e.:
www.example.com/somepage.asp?name1='value1'&name2='value2'

Instead, just do this:
www.example.com/somepage.asp?name1=value1&name2=value2

Because parameters must be passed as strings, the receiving page will read
them in as strings even though they aren't quoted.

I'd be interested in knowing if I got that right, so a confirmation would be
appreciated. :)
 
S

Steve G

Hi Jack...thanks for responding...

In regular html, you would be absolutely correct on everything you say.
However, this is a .asp page. Since this is contained within a
response.write, the double quotes are necessary. Also, there are no spaces
in the string involved with creating the url. For instance, strVal evaluates
to: 1,2

Thanks

Steve G
 
J

Jack Brewster

Steve,

It shows single quotes around the value. Those are the quotes I was saying
don't need to be there.

Also, since %20 is a 'space' encoded, there's a space coming from somewhere.
It doesn't look like it's being introduced in your loop, however there is
what appears to be an extra space after the last single quote in your
output. How that's showing up _before_ the value ('%202') is beyond me,
though.
 
K

Kevin Spencer

It shows single quotes around the value. Those are the quotes I was
saying
don't need to be there.

In fact, the single quotes are illegal URL characters and SHOULD NOT be
there. One must remember that an ASP page is just HTML when it reaches the
browser. There are no special rules for how the browser behaves when the
page loaded has an .asp extension. In the browser, the ASP page should
behave just like any other HTML page. Also, spaces are illegal URL
characters, and while MSIE is very forgiving about such things, Netscrape
and some other browsers are not. It is extremely important to make sure that
the generated URL contains NO illegal URL characters.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
S

Steve G

yep..you are right...there is definitely a space getting created here. But
it gets a little stranger than that. There are actually two records in the
record set used to create the array, and the field value I am using is
gameID. The first record has an id of 1, the second an id of 2. If I click
on the link related to id 1, it works, but when I click on the link for id
2, I get that space. Here is the html being generated by the server related
to this:

<param name='url0'
value="http://www.thenetcafe-kc.com/working/nysso/scoreboard.asp?par=1">
<param name='url1'
value="http://www.thenetcafe-kc.com/working/nysso/scoreboard.asp?par= 2">

I have looked at the code character by character, and cannot see how the
heck that space before the 2 is getting in there....

Steve G
 
J

Jack Brewster

If you're not getting the space on all records, I think it's safe to assume
there's a problem in your data. How many other records are in the table?
If it's only those two, try replacing the second record with a new entry.
It's possible you entered the space when you created the record.
 
S

Steve G

FOUND IT!!!!!! <S>

You were absolutely right about the space. It was buried in the third line
down in the code I showed....sheesh, don't know why I kept overlooking it.

Thanks again, Jack

Steve G
 
T

Thomas A. Rowe

You need to pass it to the page as Jack indicated, then you need to build
your response.write on the page receiving the parameters of the querystring.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 

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

Top