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

Graphics and Variables

Status
Not open for further replies.

MRQuestion

Technical User
Jul 16, 2002
12
0
0
US
Hi,
I'm new to asp so could someone help me with this variable. I would like an user to enter a number 1-6 into "fname" and click submit and for the page to return a picture with the varible in the source.

I.E.
<img src=&quot;/images/Map/loc&quot;& (&quot;fnum&quot;) &&quot;.gif&quot;>

here is my code
++++++++++++++++++++++++++++++++++++++++++++++
<html>
<body>

<form action=&quot;demo_mapping.asp&quot; method=&quot;get&quot;>
Please enter the number 1-6:
<input type=&quot;text&quot; name=&quot;fnum&quot;><br><br>
<input type=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

<%
If Request.QueryString(&quot;fnum&quot;)<>&quot;&quot; Then
Response.Write (&quot;the number you chose was &quot; & Request.QueryString(&quot;fnum&quot;) & &quot;!&quot;)
End If

%>
<img src=&quot;/images/Map/loc4.gif&quot;>
</body>
</html>

Thanks a bunch

MR Question
 
Something like this? I didn't try it though.



<html>
<body>

<form action=&quot;demo_mapping.asp&quot; method=&quot;Post&quot;>
Please enter the number 1-6:
<input type=&quot;text&quot; name=&quot;fnum&quot;><br><br>
<input type=&quot;submit&quot; value=&quot;Submit&quot;>
</form>

<%
If Request.Form(&quot;fnum&quot;)<>&quot;&quot; Then
Response.Write (&quot;the number you chose was &quot; & Request.Form(&quot;fnum&quot;) & &quot;!&quot;)
End If

%>
Response.Write &quot;<img src=&quot;images/Map/loc&quot; & Request.Form(&quot;fnum&quot;) & &quot;.gif>&quot;

</body>
</html>

 
this line is out of the %> plus another / will probably be needed

Response.Write &quot;<img src=&quot;images/Map/loc/&quot; & Request.Form(&quot;fnum&quot;) & &quot;.gif>&quot;
%> [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
I've moved the line into the %>.
I want the variable to be part of the file name
loc1.gif
loc2.gif
loc3.gif....
With the new setup I get..

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/asp3/ch01/FIXFORM.ASP, line 13

Response.Write &quot;<img src=&quot;images/Map/loc&quot;& Request.Form(&quot;fnum&quot;)&&quot;.gif>&quot;
--------------------------^

Thanks all
 
try
Response.Write &quot;<img src='images/Map/loc&quot; & Request.Form(&quot;fnum&quot;)& &quot;.gif'>&quot;

this would would read then
<img src='images/Map/loc.gif'>

I like to write what I want to have generated out before I write the response.write, it finds errors before they occur many times

all you did here was forgot to end the src tag with a quote
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Thanks for all the help. Everything works great however, Ive tried to add a background image. Does this look right

Response.Write (&quot;<br><img src='/images/Map/loc&quot; & Request.Form(&quot;fnum&quot;)& &quot;.gif' style=background-image: url('/images/Map/map.gif')>&quot;)


Should all &quot; be converted to ' when enclosed within the
<% %> except for the variable?


Thanks again
 
no not all the &quot; need to be '. just a good practice and commonly in some cases can cause wierd errors.
what exactly are you trying to do with the style here. you can't do the background to a img src either way but I'm curious if you are jsut trying to set the pages background or what. If that is the case

<html>
<head>
<style>
{
background-image: url(&quot;/images/Map/map.gif&quot;);
}
</style>
Response.Write (&quot;<br><img src='/images/Map/loc&quot; & Request.Form(&quot;fnum&quot;)& &quot;.gif'>&quot; [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
I am messing with an application which will locate people on a building map. I have a test map with six locations and six different images showing an x in each location. the x would be the image called with the background image being the map. I'll have to try a different route

Thanks for everyones help

Mr. Question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top