0

Simple question. I have a program that uses AJAX to send data from an HTML form to a PHP script that creates a PDF. If a user inputs a value on the HTML form that has an apostrophe it's encoded/escaped with a backslash. For instance, 'Joe's' becomes 'Joe\s'

How can remove the backslash? I suppose I could use str_replace('\', '', $input) but I'm wondering what a broader approach to 'unescaping' a string is in PHP.

1
  • 2
    Disable MAGIC_QUOTES. Commented Nov 4, 2013 at 16:45

2 Answers 2

3

Normal use of Ajax will not add slash characters to data.

The most likely source of them is magic quotes (which are evil). Turn them off.

Sign up to request clarification or add additional context in comments.

3 Comments

It would be nice to explain why they should be disabled
The magic quotes documentation (which I linked to) explains their drawbacks.
Okey, I didn't see the link on the left
0

Just use stripslashes($input);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.