Another Newbie - pass url variable in asp file

T

TNG

I'm losing a lot of time searching the web, but I think this is also a quite
simple question:

I want an image file name changed, passing a variable in the url like this:

www.server.com\myfile.asp?variable=imagefilename

this is my code:

<%
Dim variable
variable= request.querystring("imagefilename")
%>
<IMG height="26" src="images\" & <%variable%>& ".gif" width="140"
border="0">

Where do I go wrong.

Many thanks

TNGgroup
 
C

Christopher Brandsdal

You go wrong with your Request.QueryString...
It should be variable= request.querystring("variable")
 
E

Evertjan.

Christopher Brandsdal wrote on 13 jul 2004 in
microsoft.public.inetserver.asp.general:
src="images\" & <%variable%>& ".gif"

clientside, html does not execute scripts outside an event or a <script
declaration.

<%variable%> needs an =

so, do the scripting serverside [vbs]:

src="<%="images\"&request.querystring("variable")&".gif"%>"
 
T

TNG

Bedankt Evertjan

I'll give it a try


Evertjan. said:
Christopher Brandsdal wrote on 13 jul 2004 in
microsoft.public.inetserver.asp.general:
src="images\" & <%variable%>& ".gif"

clientside, html does not execute scripts outside an event or a <script
declaration.

<%variable%> needs an =

so, do the scripting serverside [vbs]:

src="<%="images\"&request.querystring("variable")&".gif"%>"
 
E

Evertjan.

TNG wrote on 13 jul 2004 in microsoft.public.inetserver.asp.general:

btw, in src= always use /

src="<%="images/"&request.querystring("variable")&".gif"%>"
 
T

TNG

This works great, but the problem is, when I use this in an include command,
it does not work.

Like this

in File1.asp
<!--#include file="file2.asp?var=comment"-->

And when I open file1.asp, I get an error message:
Include file not found ?

Is there a way around this ?

Thx
 
C

Christopher Brandsdal

Don't think this will work...
When you perform a #include, you have to include the whole file...

But why do you have to do this?
 
T

TNG

It was quite a setup, I made it a little bit easier, so It's indeed not
needed anymore.
So thanks for the assistance.

Regards
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top