0

I'm retrieving a string from a database that was entered by a form, but if the string is to long, it's generated with double quotes in the html. This is how I'm retrieving the data:

echo '<p>' . $descr['field_value'] . '</P>';

When I view the html source, the browser adds double quotes.

short single line strings do not show up with quotes.

Is there a way to force php to display strings without quotes?

1
  • PHP wouldn't be adding quotes to your data, and the database shouldn't either. If quotes are appearing, it would have to be when the data's being inserted into the DB in the first place. Have you run the queries manually from the mysql monitor to see what comes out, without PHP being involved? Commented Dec 20, 2010 at 21:48

1 Answer 1

1

You should use echo '<p>' . htmlspecialchars($desc['field_value']) . '</p>';.

See http://php.net/manual/en/function.htmlspecialchars.php for more details.

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

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.