• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

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.

1 Solution
> 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now