Home > ASP Development > Format a string to stop speech mark errors

Format a string to stop speech mark errors



I have a form which sends a link from a text field -



<input name="wishList" type="hidden" value="<a href='<%=url_link%>?ID=<%=sendID%>&myMonth=<%=sendMonth%>' class='link-onDarkGrey'><%=tripType%> in <%=country%> - <%=mStartDate%></a>">



I need to set a session variable to this value but I think the apostrophies are getting in the way.



session("choices") = request.Form("wishList")





what's the best way to format that lot?



later I want to concatenate several requests so I can display them.



session("choices") = session("choices")&"<br>"&request.Form("wishList")



will this work?

thanks

M

by the way your code tags are not working for me today for some reason

    
Guest


Quote:
I need to set a session variable to this value but I think the apostrophies are getting in the way.


what do you mean by this? ... your question is really vague

Was this answer helpful ? Yes No   
Guest


The ASP sees the apostrophe and thinks it is a comment.

or sees a speech mark and thinks it is the end of the string.



but as you can see I need one or the other.



it would be nice if we could surround the whole lot with something else to tell ASP to ignor the contents

Was this answer helpful ? Yes No   
Guest


try like this:


Code:



<input name="wishList" type="hidden" value="<a href="<%=url_link%>?ID=<%=sendID%>&myMonth=<%=sendMonth%>" class="link-onDarkGrey"><%=tripType%> in <%=country%> - <%=mStartDate%></a>">



Was this answer helpful ? Yes No   
Guest


Thank you, that makes sense.

I am processing and displaying the form value using this code in the same page but nothing is working.

I have checked the source code of the outputted page but none of the response.write statements are doing anything.


Code:



<% dim wishList,trip,wishListUrl,wishRS, newChoice, choices
if request.Form("wishList") <> "" then

wishListUrl = request.Form("wishListUrl")
session("choices") = session("choices")&"<br>"&request.Form("wishList")
session("tripID") = session("tripID")&","&request.queryString("ID")
response.Write(request.Form("wishList"))
response.Write(session("choices"))
response.Write(session("tripID"))
session("wishListActive") = 1
choices=session("choices")

response.redirect("a.asp?ID=230&myMonth=10")' change this to wishListUrl later
end if

if session("wishListActive") = 1 then %>
<table width="98%" border="0" cellpadding="10" cellspacing="0">
<tr valign="top" bgcolor="#333E3F">
<td > <div align="center"><span class="Heading">Wish List</span><br>
</div></td>
</tr>

<tr valign="top">
<td ><span class="description"><%=choices%></span></td>
</tr>

</table>
<% end if %>



Was this answer helpful ? Yes No   
Guest


I have found my own mistake.

I was redirecting the page (a legacy from using a DB)

so the response.write were erased again before I saw them.

They all work fine now. and the quotation mark fix works a treat.

Thanks Mehere

Was this answer helpful ? Yes No   
Guest


np ... glad you got it sorted

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved