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

Error in Simple ASP

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

This is my first time ASP coding and as ever, its not working too well.

Here is my first page which is fine:

Code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<H3>Holiday Form</H3>
Please select one or more destinations that you would like brochures for:
<FORM ACTION=&quot;ResponseQueryString.asp&quot; METHOD=GET>
<SELECT SIZE=3 NAME=&quot;HolidayLocation&quot; MULTIPLE>
  <OPTION>Madrid</OPTION>
  <OPTION>Rome</OPTION>
  <OPTION>Paris</OPTION>
  <OPTION>Berlin</OPTION>
  <OPTION>Moscow</OPTION>
  <OPTION>Birmingham</OPTION>
</SELECT>
<INPUT TYPE=&quot;SUBMIT&quot;>
</FORM>
</BODY>
</HTML>

And here is the ASP page which don't. Basically upon selecting an option, i want it to include the CSS style page which i have designed Can someone sort it out please?

Code:
<%Option Explicit%>
<HTML>
<HEAD>
<style>

<%
  If Request.QueryString(&quot;HolidayLocation&quot;) =&quot;madrid&quot; then
    Response.write <!-- #Include file=&quot;Stylesmardrid.css&quot; -->
  Else 
Response.write <!-- #Include file=&quot;Styles.css&quot; -->
End if
%>
</style>
<TITLE></TITLE>
</HEAD>
<BODY>
<H3>Holiday Response Form

 as requested </H3>
</BODY>
</HTML>

Thankyou

James
 
where you are response.writing out the include, the &quot;&quot; are going to give you problems. try this:

Response.write &quot;<!-- #Include file='Stylesmardrid.css' -->&quot;

Whatever is inside the &quot;&quot; is what should be being displayed as a literal. When a command inside of the &quot;&quot; uses &quot;&quot; as well, you have to convert them to '' instead. Obviously, you'll need to change the others as well.

You also might want consider using the POST method instead of GET. And, I would consider renaming your second page. I don't know that responsequerystring.asp is a good idea. May be recognizing as reserved words.

hth
mb
&quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
Hi,

Unfortuantley, now this gives in the final version when it appears in the browser:

Code:
<HTML>
<HEAD>
<style><!-- #Include file='Stylesmardrid.css' --></style>
<TITLE></TITLE>
</HEAD>
<BODY>
<H3>Holiday Response Form</H3>

 as requested.
</BODY>
</HTML>

This is not what I want, I want the line to show
Code:
<style> ~~shows all the styles from css file </style>

Any help?

Cheers

 
Hi James,

try this instead:

<%Option Explicit%>
<HTML>
<HEAD>

<%
If Request.QueryString(&quot;HolidayLocation&quot;) =&quot;madrid&quot; then
%>

<link rel=&quot;stylesheet&quot; href=&quot;Stylesmardrid.css&quot; type=&quot;text/css&quot;>

<%
Else
%>

<link rel=&quot;stylesheet&quot; href=&quot;Styles.css&quot; type=&quot;text/css&quot;>

<%
End if
%>

<TITLE></TITLE>
</HEAD>
<BODY>
<H3>Holiday Response Form

as requested </H3>
</BODY>
</HTML>



Hope this helps! Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Thanks Nic, that works a treat!

Cheers

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top