Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Escaping Hidden Information

Quote Reply
Escaping Hidden Information
Hi,

I'm passing some text through to another page where it is being stored as a hidden field. Becuase it comes from a text block originally, I've found I have to use <PRE> tags around it so it keeps its formatting with new lines etc ( does anyone know a better way to do that?).

The problem I'm having though is if a user passes through any text that includes " or ' it breaks the tags I'm using to enclose the text, so it needs to be escaped somehow.

I read about the <%escapeURL somevar%> call in the help pages but am a little consused about how to use it, especially if the text is to be passed back to a script again and re-displayed in the original text block - does it also need to be unescaped when going back into the script again?

Can anyone help me out with this one?

Thanks
R.

Quote Reply
Re: Escaping Hidden Information In reply to
Hi,

You should do this:

<input type=hidden name="pass_through" value="<%GT::CGI::html_escape ($form_name)%>">

where form_name is the name of the textarea on the previous page.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Escaping Hidden Information In reply to
Thanks Alex,

Works perfectly.

Still needed to use the <PRE></PRE> tags to preserve new lines etc too if anyone else is trying to do the same.

Cheers,
R.