Handling special chars (apostrophes,backslashes,etc) in html forms across multiple pages

In my html forms, I have textfields and textarea's that will contain backslashes and/or apostrophes.  The problem is I have multiple forms across multiple pages.

I post the data from the first page onto the second page, and its put into hidden fields.  Special characters are automatically escaped with a backslash.  The problem is, if the user goes back, the data is posted to the first page and the special characters are escaped again!

So for example, on page 1, if a user enters "I can't type" in the textarea and hits submit:

Page 2 will contain a hidden input field with the value "I can\'t type" and some other input boxes.  If the user hits back, the data is submitted to page 1.

Page 1 will get the posted data as "I can\\\'t type" and then my php script will put that data into the text area.

What's the best way to deal with this problem?  The pages use php, javascript and html forms.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

> Special characters are automatically escaped with a backslash.


The browser should handle that on its own...
I agree with TimYates, it is strange. Could you post PHP code?
JonAquaAuthor Commented:
Nevermind sorry, I found what I needed after posting this but the website wasnt loading for some reason and I got busy with another project.

>> Special characters are automatically escaped with a backslash.
>The browser should handle that on its own...

Yes when I referred to it being done automatic I was referring to the browser.

For anyone else that has a similiar problem, I just used the php function stripslashes.
PAQed with points refunded (250)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.