Ok, I have searched all over the net for this problem and everything I read says that there's a single quote ( ' ) problem but not a double quote ( " ) problem. Mine however is.
I have a form like this:
****form.asp****
<form name="tester" method="post" action="test2.asp">
<textarea cols=60 rows=30 name="story"></textarea>
<input type="submit" value=" submit ">
</form>
Then it sends it to this page where I get textarea value and then pass it to another form through a hidden form field:
****test2.asp****
<%
uStory=TRIM(request("story"))
%>
<form name="tester2" method="post" action="test3.asp">
<input type="hidden" name="theNewStory" value="<%=uStory%>">
<input type="submit" value=" submit ">
</form>
It goes to this page where the problem occurs:
****test3.asp****
<%
nStory=TRIM(request("theNewStory"))
response.write nStory
%>
The problem is, when a user enters double quotes into the textarea like this:
Hello my name is "John" and today we will learn about cats.
Well, when that value is sent to test2.asp page, and I response.write the value, it comes through just perfect, just as it is typed above. But then when its passed through the hidden form field and onto test3.asp, when I response.write the value it shows as:
Hello my name is
So its choking on the double quotes here. Although it doesn't choke the first time. I have thought of using the replace function like:
nStory=Replace(nStory, """, """")
but you cant put a double quote inside double quotes or vbscript treats it as a set of double quotes, and then a single double quote and messes the page up.
Can someone please help me here or let me know if I am doing something wrong.
Thanks much in advance ~
webdude
****test2.asp****
<%
uStory=TRIM(request("story
uStory = replace(ustory, """", "''") '<----------replace double quotes with 2 single quotes
%>
<form name="tester2" method="post" action="test3.asp">
<input type="hidden" name="theNewStory" value="<%=uStory%>">
<input type="submit" value=" submit ">
</form>