Requiering the substring, in ASP!

They have: 133 posts

Joined: Sep 2000

Hi again all

This should be a rather simple question:

How du I get the substring down?
e.g. I have a link that is something like: "proc.htm?id=1" Then I want ASP to get the variable down from the substring, so that I can use it in order to get the right information from a database!

I can easlily do it in Javascript like this':


<script language="javascript">
var id2= location.search.substr(1).split("=")
var id=id2[1].split("'")
document.write(id[0])
</script>

(or something like that)

I am preety su´re that it is posible to do that in ASP, ´but can someone tell me how it is done? I dont need any fancy code, on how to use it, that has been taken care of Smiling

Hope that you can help me... again Wink

Kind regards
Casper

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

hotcut,

Sounds like you need a good ASP book Smiling

This is part of the Request object, for your example it would be:

Request.QueryString("id")

This will return the value of "id" which in your example would be 1.

Regards,
Peter J. Boettcher

PJ | Are we there yet?
pjboettcher.com

They have: 133 posts

Joined: Sep 2000

Hi Peter

Thanks for that, and I can say that you are right!!!
I REALY do need a good ASP book! But... I am not sure what one to choose... The danish collection of ASP books is rather small... It is hard to find one...

Anyway, I will try to stop bothering you this much in the future... But I got to learn it, you know Smiling

Thanks for you quick ansver
Casper

They have: 5,633 posts

Joined: Jan 1970

Hotcut,

Also note that you if you are using a Form Post then you'll get the inputs from Request.Form("id") rather than Request.QuerySting("id").

They have: 133 posts

Joined: Sep 2000

I know about that, but thank you anyway...

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.